Special-case item attributes in the suggestion output

This commit is contained in:
Esteban Küber 2023-04-10 16:46:12 +00:00
parent 5b40aa5eb4
commit 9fadcc143a
84 changed files with 10 additions and 188 deletions

View file

@ -1886,6 +1886,7 @@ fn emit_suggestion_default(
}
let mut unhighlighted_lines = Vec::new();
let mut last_pos = 0;
let mut is_item_attribute = false;
for (line_pos, (line, highlight_parts)) in lines.by_ref().zip(highlights).enumerate() {
last_pos = line_pos;
debug!(%line_pos, %line, ?highlight_parts);
@ -1895,6 +1896,12 @@ fn emit_suggestion_default(
unhighlighted_lines.push((line_pos, line));
continue;
}
if highlight_parts.len() == 1
&& line.trim().starts_with("#[")
&& line.trim().ends_with(']')
{
is_item_attribute = true;
}
match unhighlighted_lines.len() {
0 => (),
@ -1971,11 +1978,13 @@ fn emit_suggestion_default(
is_multiline,
)
}
if let DisplaySuggestion::Add = show_code_change {
if let DisplaySuggestion::Add = show_code_change && is_item_attribute {
// The suggestion adds an entire line of code, ending on a newline, so we'll also
// print the *following* line, to provide context of what we're advicing people to
// do. Otherwise you would only see contextless code that can be confused for
// already existing code, despite the colors and UI elements.
// We special case `#[derive(_)]\n` and other attribute suggestions, because those
// are the ones where context is most useful.
let file_lines = sm
.span_to_lines(span.primary_span().unwrap().shrink_to_hi())
.expect("span_to_lines failed when emitting suggestion");

View file

@ -7,13 +7,10 @@ LL | _n: PhantomData,
help: consider importing one of these items
|
LL + use core::marker::PhantomData;
LL | trait TypeVal<T> {
|
LL + use serde::__private::PhantomData;
LL | trait TypeVal<T> {
|
LL + use std::marker::PhantomData;
LL | trait TypeVal<T> {
|
error[E0412]: cannot find type `VAL` in this scope

View file

@ -14,7 +14,6 @@ LL + fn default() -> Self {
LL + Self::new()
LL + }
LL + }
LL | impl Foo {
|
error: you should consider adding a `Default` implementation for `Bar`
@ -32,7 +31,6 @@ LL + fn default() -> Self {
LL + Self::new()
LL + }
LL + }
LL | impl Bar {
|
error: you should consider adding a `Default` implementation for `LtKo<'c>`
@ -50,7 +48,6 @@ LL + fn default() -> Self {
LL + Self::new()
LL + }
LL + }
LL | impl<'c> LtKo<'c> {
|
error: you should consider adding a `Default` implementation for `NewNotEqualToDerive`
@ -68,7 +65,6 @@ LL + fn default() -> Self {
LL + Self::new()
LL + }
LL + }
LL | impl NewNotEqualToDerive {
|
error: you should consider adding a `Default` implementation for `FooGenerics<T>`
@ -86,7 +82,6 @@ LL + fn default() -> Self {
LL + Self::new()
LL + }
LL + }
LL | impl<T> FooGenerics<T> {
|
error: you should consider adding a `Default` implementation for `BarGenerics<T>`
@ -104,7 +99,6 @@ LL + fn default() -> Self {
LL + Self::new()
LL + }
LL + }
LL | impl<T: Copy> BarGenerics<T> {
|
error: you should consider adding a `Default` implementation for `Foo<T>`

View file

@ -8,7 +8,6 @@ LL | s.the_fn();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use Lib::TheTrait;
LL | use Lib::TheStruct;
|
error: aborting due to previous error

View file

@ -8,7 +8,6 @@ LL | s.the_fn();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use coherence_inherent_cc_lib::TheTrait;
LL | use coherence_inherent_cc_lib::TheStruct;
|
error: aborting due to previous error

View file

@ -9,7 +9,6 @@ help: consider enabling this feature
--> $DIR/issue-94287.rs:1:1
|
LL + #![feature(generic_const_exprs)]
LL | #![feature(generic_const_exprs)]
|
error: aborting due to previous error

View file

@ -7,16 +7,12 @@ LL | let mut iter = IntoIter::new(self);
help: consider importing one of these items
|
LL + use std::array::IntoIter;
LL | pub struct ConstCheck<const CHECK: bool>;
|
LL + use std::collections::binary_heap::IntoIter;
LL | pub struct ConstCheck<const CHECK: bool>;
|
LL + use std::collections::btree_map::IntoIter;
LL | pub struct ConstCheck<const CHECK: bool>;
|
LL + use std::collections::btree_set::IntoIter;
LL | pub struct ConstCheck<const CHECK: bool>;
|
and 8 other candidates

View file

@ -7,7 +7,6 @@ LL | let mut map = HashMap::new();
help: consider importing this struct
|
LL + use std::collections::HashMap;
LL | use std::io::prelude::*;
|
error: aborting due to previous error

View file

@ -25,16 +25,12 @@ LL | fn setup() -> Set { Set }
help: consider importing one of these items
|
LL + use AffixHeart::Set;
LL | enum PutDown { Set }
|
LL + use CauseToBe::Set;
LL | enum PutDown { Set }
|
LL + use Determine::Set;
LL | enum PutDown { Set }
|
LL + use PutDown::Set;
LL | enum PutDown { Set }
|
and 3 other candidates

View file

@ -14,7 +14,6 @@ LL | g();
help: consider importing this function
|
LL + use foo::f;
LL | mod foo {
|
error[E0425]: cannot find function `g` in this scope
@ -41,7 +40,6 @@ LL | f();
help: consider importing this function
|
LL + use bar::g;
LL | mod foo {
|
error[E0425]: cannot find function `f` in this scope

View file

@ -11,7 +11,6 @@ LL | Vec::new();
help: consider importing this struct
|
LL + use std::vec::Vec;
LL | pub macro m() { Vec::<i32>::new(); ().clone() }
|
error[E0599]: no method named `clone` found for unit type `()` in the current scope
@ -28,7 +27,6 @@ LL | ().clone()
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use std::clone::Clone;
LL | pub macro m() { Vec::<i32>::new(); ().clone() }
|
error: aborting due to 2 previous errors

View file

@ -15,7 +15,6 @@ LL | pub macro m() { ().f() }
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use foo::T;
LL | use foo::*;
|
error: aborting due to previous error

View file

@ -8,16 +8,12 @@ LL | 1u32.method();
help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
|
LL + use foo::Bar;
LL | extern crate no_method_suggested_traits;
|
LL + use no_method_suggested_traits::Reexported;
LL | extern crate no_method_suggested_traits;
|
LL + use no_method_suggested_traits::foo::PubPub;
LL | extern crate no_method_suggested_traits;
|
LL + use no_method_suggested_traits::qux::PrivPub;
LL | extern crate no_method_suggested_traits;
|
error[E0599]: no method named `method` found for struct `Rc<&mut Box<&u32>>` in the current scope
@ -30,16 +26,12 @@ LL | std::rc::Rc::new(&mut Box::new(&1u32)).method();
help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
|
LL + use foo::Bar;
LL | extern crate no_method_suggested_traits;
|
LL + use no_method_suggested_traits::Reexported;
LL | extern crate no_method_suggested_traits;
|
LL + use no_method_suggested_traits::foo::PubPub;
LL | extern crate no_method_suggested_traits;
|
LL + use no_method_suggested_traits::qux::PrivPub;
LL | extern crate no_method_suggested_traits;
|
error[E0599]: no method named `method` found for type `char` in the current scope
@ -55,7 +47,6 @@ LL | 'a'.method();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use foo::Bar;
LL | extern crate no_method_suggested_traits;
|
error[E0599]: no method named `method` found for struct `Rc<&mut Box<&char>>` in the current scope
@ -68,7 +59,6 @@ LL | std::rc::Rc::new(&mut Box::new(&'a')).method();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use foo::Bar;
LL | extern crate no_method_suggested_traits;
|
error[E0599]: no method named `method` found for type `i32` in the current scope
@ -86,7 +76,6 @@ LL | fn method(&self) {}
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use no_method_suggested_traits::foo::PubPub;
LL | extern crate no_method_suggested_traits;
|
error[E0599]: no method named `method` found for struct `Rc<&mut Box<&i32>>` in the current scope
@ -99,7 +88,6 @@ LL | std::rc::Rc::new(&mut Box::new(&1i32)).method();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use no_method_suggested_traits::foo::PubPub;
LL | extern crate no_method_suggested_traits;
|
error[E0599]: no method named `method` found for struct `Foo` in the current scope

View file

@ -7,7 +7,6 @@ LL | fn wants_debug(g: impl Debug) { }
help: consider importing this trait instead
|
LL + use std::fmt::Debug;
LL | use std::fmt::Display;
|
error[E0404]: expected trait, found derive macro `Debug`
@ -19,7 +18,6 @@ LL | fn wants_display(g: impl Debug) { }
help: consider importing this trait instead
|
LL + use std::fmt::Debug;
LL | use std::fmt::Display;
|
error: aborting due to 2 previous errors

View file

@ -61,7 +61,6 @@ LL | import();
help: consider importing this function
|
LL + use other::import;
LL | use bar::*;
|
error[E0412]: cannot find type `A` in this scope

View file

@ -13,7 +13,6 @@ LL | baz();
help: consider importing this function instead
|
LL + use bar::baz;
LL | use foo::f::{self};
|
error: aborting due to 2 previous errors

View file

@ -19,7 +19,6 @@ LL | foo();
help: consider importing this function instead
|
LL + use foo::foo;
LL | use m1::*;
|
error: aborting due to 2 previous errors

View file

@ -7,7 +7,6 @@ LL | fn sub() -> isize { foo(); 1 }
help: consider importing this function
|
LL + use foo::foo;
LL | use a::b::*;
|
error: aborting due to previous error

View file

@ -13,7 +13,6 @@ LL | pub trait Tr { fn method(&self); }
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use overlapping_pub_trait_source::m::Tr;
LL | extern crate overlapping_pub_trait_source;
|
error: aborting due to previous error

View file

@ -13,7 +13,6 @@ LL | pub trait Tr { fn method(&self); }
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use unnamed_pub_trait_source::prelude::*; // trait Tr
LL | extern crate unnamed_pub_trait_source;
|
error: aborting due to previous error

View file

@ -8,7 +8,6 @@ LL | b.foo();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use a::A;
LL | use b::B;
|
error: aborting due to previous error

View file

@ -25,16 +25,12 @@ LL | fn new() -> Result<foo::MyEnum, String> {
help: consider importing one of these items instead
|
LL + use std::fmt::Result;
LL | use foo::MyEnum::Result;
|
LL + use std::io::Result;
LL | use foo::MyEnum::Result;
|
LL + use std::result::Result;
LL | use foo::MyEnum::Result;
|
LL + use std::thread::Result;
LL | use foo::MyEnum::Result;
|
error[E0573]: expected type, found variant `Result`
@ -46,16 +42,12 @@ LL | fn new() -> Result<foo::MyEnum, String> {
help: consider importing one of these items instead
|
LL + use std::fmt::Result;
LL | use foo::MyEnum::Result;
|
LL + use std::io::Result;
LL | use foo::MyEnum::Result;
|
LL + use std::result::Result;
LL | use foo::MyEnum::Result;
|
LL + use std::thread::Result;
LL | use foo::MyEnum::Result;
|
error[E0573]: expected type, found variant `NoResult`

View file

@ -10,7 +10,6 @@ LL | arg.wait();
help: another candidate was found in the following trait, perhaps add a `use` for it:
|
LL + use private::Future;
LL | mod private {
|
error: aborting due to previous error

View file

@ -7,7 +7,6 @@ LL | struct Foo<T: ?Hash> { }
help: consider importing this trait instead
|
LL + use std::hash::Hash;
LL | struct Foo<T: ?Hash> { }
|
warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported

View file

@ -8,7 +8,6 @@ LL | Command::new("echo").arg("hello").exec();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use std::os::unix::process::CommandExt;
LL | use std::process::Command;
|
error: aborting due to previous error

View file

@ -13,7 +13,6 @@ LL | fn trait_method(&self) {
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use reexported_trait::Trait;
LL | fn main() {
|
error[E0599]: no method named `trait_method_b` found for struct `FooStruct` in the current scope
@ -31,7 +30,6 @@ LL | fn trait_method_b(&self) {
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use reexported_trait::TraitBRename;
LL | fn main() {
|
error: aborting due to 2 previous errors

View file

@ -7,7 +7,6 @@ LL | _n: PhantomData,
help: consider importing this struct
|
LL + use std::marker::PhantomData;
LL | fn main() {
|
error[E0412]: cannot find type `VAL` in this scope

View file

@ -7,7 +7,6 @@ LL | static FOO: (dyn AsRef<OsStr>, u8) = ("hello", 42);
help: consider importing this struct
|
LL + use std::ffi::OsStr;
LL | static FOO: (dyn AsRef<OsStr>, u8) = ("hello", 42);
|
error[E0412]: cannot find type `Path` in this scope
@ -19,7 +18,6 @@ LL | const BAR: (&Path, [u8], usize) = ("hello", [], 42);
help: consider importing this struct
|
LL + use std::path::Path;
LL | static FOO: (dyn AsRef<OsStr>, u8) = ("hello", 42);
|
error[E0277]: the size for values of type `[u8]` cannot be known at compilation time

View file

@ -8,7 +8,6 @@ LL | #[issue_100199::struct_with_bound]
help: consider importing this trait
|
LL + use traits::MyTrait;
LL | #[issue_100199::struct_with_bound]
|
error: aborting due to previous error

View file

@ -7,7 +7,6 @@ LL | a::bar();
help: consider importing this function
|
LL + use b::bar;
LL | macro_rules! test { ($nm:ident,
|
help: if you import `bar`, refer to it directly
|

View file

@ -15,10 +15,8 @@ LL | check(m1::TS);
help: consider importing one of these items instead
|
LL + use m2::S;
LL | use namespace_mix::*;
|
LL + use xm2::S;
LL | use namespace_mix::*;
|
help: if you import `S`, refer to it directly
|
@ -45,10 +43,8 @@ LL | check(xm1::TS);
help: consider importing one of these items instead
|
LL + use m2::S;
LL | use namespace_mix::*;
|
LL + use xm2::S;
LL | use namespace_mix::*;
|
help: if you import `S`, refer to it directly
|
@ -73,10 +69,8 @@ LL | check(m7::TV);
help: consider importing one of these items instead
|
LL + use m8::V;
LL | use namespace_mix::*;
|
LL + use xm8::V;
LL | use namespace_mix::*;
|
help: if you import `V`, refer to it directly
|
@ -103,10 +97,8 @@ LL | check(xm7::TV);
help: consider importing one of these items instead
|
LL + use m8::V;
LL | use namespace_mix::*;
|
LL + use xm8::V;
LL | use namespace_mix::*;
|
help: if you import `V`, refer to it directly
|

View file

@ -13,7 +13,6 @@ LL | println!("{}", circular_modules_main::hi_str());
help: consider importing this function
|
LL + use hi_str;
LL | #[path = "circular_modules_main.rs"]
|
help: if you import `hi_str`, refer to it directly
|

View file

@ -14,7 +14,6 @@ LL | Baz();
help: consider importing this function instead
|
LL + use foo2::Bar;
LL | pub mod foo1 {
|
error[E0425]: cannot find function, tuple struct or tuple variant `Bar` in this scope
@ -33,7 +32,6 @@ LL | Baz();
help: consider importing this function
|
LL + use foo2::Bar;
LL | pub mod foo1 {
|
error[E0412]: cannot find type `Bar` in this scope
@ -52,7 +50,6 @@ LL | let _x: Box<Baz>;
help: consider importing this trait
|
LL + use foo1::Bar;
LL | pub mod foo1 {
|
error[E0747]: constant provided when a type was expected

View file

@ -7,7 +7,6 @@ LL | Bar();
help: consider importing this function instead
|
LL + use foo2::Bar;
LL | pub mod foo1 {
|
error[E0423]: expected function, tuple struct or tuple variant, found trait `Bar`
@ -26,7 +25,6 @@ LL | Baz();
help: consider importing this function instead
|
LL + use foo2::Bar;
LL | pub mod foo1 {
|
error[E0573]: expected type, found function `Bar`
@ -42,7 +40,6 @@ LL | let _x = Bar();
help: consider importing this trait instead
|
LL + use foo1::Bar;
LL | pub mod foo1 {
|
error[E0603]: trait `Bar` is private

View file

@ -7,7 +7,6 @@ LL | Command::new("git");
help: consider importing this struct
|
LL + use std::process::Command;
LL | #[amputate_span::drop_first_token]
|
error[E0433]: failed to resolve: use of undeclared type `Command`
@ -19,7 +18,6 @@ LL | Command::new("git");
help: consider importing this struct
|
LL + use std::process::Command;
LL | #[amputate_span::drop_first_token]
|
error: aborting due to 2 previous errors

View file

@ -51,7 +51,6 @@ LL | type A = Y;
help: consider importing this struct
|
LL + use Y;
LL | pub struct X;
|
error[E0412]: cannot find type `X` in this scope
@ -63,7 +62,6 @@ LL | type A = X;
help: consider importing this struct
|
LL + use m::X;
LL | #[macro_use]
|
error: aborting due to 7 previous errors

View file

@ -7,7 +7,6 @@ LL | Foo;
help: consider importing this unit struct
|
LL + use crate::bar::Foo;
LL | mod bar {
|
error: aborting due to previous error

View file

@ -7,7 +7,6 @@ LL | let _ = namespaced_enums::A;
help: consider importing this unit variant
|
LL + use namespaced_enums::Foo::A;
LL | extern crate namespaced_enums;
|
help: if you import `A`, refer to it directly
|
@ -24,7 +23,6 @@ LL | let _ = namespaced_enums::B(10);
help: consider importing this tuple variant
|
LL + use namespaced_enums::Foo::B;
LL | extern crate namespaced_enums;
|
help: if you import `B`, refer to it directly
|
@ -41,7 +39,6 @@ LL | let _ = namespaced_enums::C { a: 10 };
help: consider importing this variant
|
LL + use namespaced_enums::Foo::C;
LL | extern crate namespaced_enums;
|
help: if you import `C`, refer to it directly
|

View file

@ -7,7 +7,6 @@ LL | let _ = size_of::<usize>();
help: consider importing this function
|
LL + use std::mem::size_of;
LL | fn main() {
|
error[E0425]: cannot find function `fabsf64` in this scope
@ -19,7 +18,6 @@ LL | let _ = fabsf64(1.0);
help: consider importing this function
|
LL + use std::intrinsics::fabsf64;
LL | fn main() {
|
error: aborting due to 2 previous errors

View file

@ -7,7 +7,6 @@ LL | impl Error for str::Utf8Error {
help: consider importing this trait
|
LL + use std::error::Error;
LL | impl Error for str::Utf8Error {
|
error[E0223]: ambiguous associated type

View file

@ -7,13 +7,10 @@ LL | Result {
help: consider importing one of these items instead
|
LL + use std::fmt::Result;
LL | pub struct GslResult {
|
LL + use std::io::Result;
LL | pub struct GslResult {
|
LL + use std::thread::Result;
LL | pub struct GslResult {
|
error: aborting due to previous error

View file

@ -7,7 +7,6 @@ LL | E { name: "foobar" };
help: consider importing this variant
|
LL + use SomeEnum::E;
LL | enum SomeEnum {
|
error: aborting due to previous error

View file

@ -7,13 +7,10 @@ LL | impl Mul for Foo {
help: consider importing one of these items
|
LL + use mul1::Mul;
LL | mod mul1 {
|
LL + use mul2::Mul;
LL | mod mul1 {
|
LL + use std::ops::Mul;
LL | mod mul1 {
|
error[E0412]: cannot find type `Mul` in this scope
@ -25,13 +22,10 @@ LL | fn getMul() -> Mul {
help: consider importing one of these items
|
LL + use mul1::Mul;
LL | mod mul1 {
|
LL + use mul2::Mul;
LL | mod mul1 {
|
LL + use std::ops::Mul;
LL | mod mul1 {
|
error[E0405]: cannot find trait `ThisTraitReallyDoesntExistInAnyModuleReally` in this scope
@ -49,7 +43,6 @@ LL | impl Div for Foo {
help: consider importing this trait
|
LL + use std::ops::Div;
LL | mod mul1 {
|
error: aborting due to 4 previous errors

View file

@ -7,10 +7,8 @@ LL | impl T for Foo { }
help: consider importing one of these items
|
LL + use baz::T;
LL | pub mod foo {
|
LL + use foo::bar::T;
LL | pub mod foo {
|
error: aborting due to previous error

View file

@ -7,7 +7,6 @@ LL | impl OuterTrait for Foo {}
help: consider importing this trait
|
LL + use issue_21221_3::outer::OuterTrait;
LL | extern crate issue_21221_3;
|
error: aborting due to previous error

View file

@ -7,7 +7,6 @@ LL | impl T for Foo {}
help: consider importing this trait
|
LL + use issue_21221_4::T;
LL | extern crate issue_21221_4;
|
error: aborting due to previous error

View file

@ -11,7 +11,6 @@ LL | Self::default();
help: consider importing this function
|
LL + use std::default::default;
LL | trait Groom {
|
error[E0425]: cannot find value `whiskers` in this scope

View file

@ -7,7 +7,6 @@ LL | B(());
help: consider importing this tuple struct
|
LL + use foo::B;
LL | fn foo() {
|
error: aborting due to previous error

View file

@ -18,7 +18,6 @@ LL | Apple(5)
help: consider importing this tuple variant
|
LL + use Fruit::Apple;
LL | enum Fruit {
|
error[E0573]: expected type, found variant `Fruit::Apple`
@ -39,7 +38,6 @@ LL | Apple(5)
help: consider importing this tuple variant
|
LL + use Fruit::Apple;
LL | enum Fruit {
|
error[E0573]: expected type, found variant `Ok`

View file

@ -11,7 +11,6 @@ LL | trait Foo = dyn issue_3907::Foo;
help: consider importing this trait instead
|
LL + use issue_3907::Foo;
LL | extern crate issue_3907;
|
error: aborting due to previous error

View file

@ -7,10 +7,8 @@ LL | const M: usize = (f64::from(N) * std::f64::LOG10_2) as usize;
help: consider importing one of these items
|
LL + use std::f32::consts::LOG10_2;
LL | fn main() {
|
LL + use std::f64::consts::LOG10_2;
LL | fn main() {
|
help: if you import `LOG10_2`, refer to it directly
|

View file

@ -108,10 +108,8 @@ LL | (E::TupleWithFields(/* fields */)).foo();
help: consider importing one of these items instead
|
LL + use std::f32::consts::E;
LL | enum A {
|
LL + use std::f64::consts::E;
LL | enum A {
|
error[E0532]: expected tuple struct or tuple variant, found enum `A`

View file

@ -7,7 +7,6 @@ LL | Cons(..) => {}
help: consider importing this tuple variant
|
LL + use list::List::Cons;
LL | mod list {
|
error: aborting due to previous error

View file

@ -7,7 +7,6 @@ LL | let _map = std::hahmap::HashMap::new();
help: consider importing this struct
|
LL + use std::collections::HashMap;
LL | fn main() {
|
help: if you import `HashMap`, refer to it directly
|

View file

@ -7,7 +7,6 @@ LL | impl Add for Test {}
help: consider importing this trait
|
LL + use std::ops::Add;
LL | struct Test;
|
error[E0404]: expected trait, found derive macro `Clone`
@ -19,7 +18,6 @@ LL | impl Clone for Test {}
help: consider importing this trait instead
|
LL + use std::clone::Clone;
LL | struct Test;
|
error[E0405]: cannot find trait `Iterator` in this scope
@ -31,7 +29,6 @@ LL | impl Iterator for Test {}
help: consider importing this trait
|
LL + use std::iter::Iterator;
LL | struct Test;
|
error[E0405]: cannot find trait `ToString` in this scope
@ -43,7 +40,6 @@ LL | impl ToString for Test {}
help: consider importing this trait
|
LL + use std::string::ToString;
LL | struct Test;
|
error[E0405]: cannot find trait `Writer` in this scope
@ -61,7 +57,6 @@ LL | drop(2)
help: consider importing this function
|
LL + use std::mem::drop;
LL | struct Test;
|
error[E0405]: cannot find trait `Add` in this scope
@ -73,7 +68,6 @@ LL | impl Add for Test {}
help: consider importing this trait
|
LL + use std::ops::Add;
LL | mod baz {
|
error[E0404]: expected trait, found derive macro `Clone`
@ -85,7 +79,6 @@ LL | impl Clone for Test {}
help: consider importing this trait instead
|
LL + use std::clone::Clone;
LL | mod baz {
|
error[E0405]: cannot find trait `Iterator` in this scope
@ -97,7 +90,6 @@ LL | impl Iterator for Test {}
help: consider importing this trait
|
LL + use std::iter::Iterator;
LL | mod baz {
|
error[E0405]: cannot find trait `ToString` in this scope
@ -109,7 +101,6 @@ LL | impl ToString for Test {}
help: consider importing this trait
|
LL + use std::string::ToString;
LL | mod baz {
|
error[E0405]: cannot find trait `Writer` in this scope
@ -127,7 +118,6 @@ LL | drop(2)
help: consider importing this function
|
LL + use std::mem::drop;
LL | mod baz {
|
error[E0405]: cannot find trait `Add` in this scope
@ -139,7 +129,6 @@ LL | impl Add for Test {}
help: consider importing this trait
|
LL + use std::ops::Add;
LL | struct Test;
|
error[E0404]: expected trait, found derive macro `Clone`
@ -151,7 +140,6 @@ LL | impl Clone for Test {}
help: consider importing this trait instead
|
LL + use std::clone::Clone;
LL | struct Test;
|
error[E0405]: cannot find trait `Iterator` in this scope
@ -163,7 +151,6 @@ LL | impl Iterator for Test {}
help: consider importing this trait
|
LL + use std::iter::Iterator;
LL | struct Test;
|
error[E0405]: cannot find trait `ToString` in this scope
@ -175,7 +162,6 @@ LL | impl ToString for Test {}
help: consider importing this trait
|
LL + use std::string::ToString;
LL | struct Test;
|
error[E0405]: cannot find trait `Writer` in this scope
@ -193,7 +179,6 @@ LL | drop(2)
help: consider importing this function
|
LL + use std::mem::drop;
LL | struct Test;
|
error: aborting due to 18 previous errors

View file

@ -7,7 +7,6 @@ LL | impl Add for Test {}
help: consider importing this trait
|
LL + use std::ops::Add;
LL | struct Test;
|
error[E0404]: expected trait, found derive macro `Clone`
@ -19,7 +18,6 @@ LL | impl Clone for Test {}
help: consider importing this trait instead
|
LL + use std::clone::Clone;
LL | struct Test;
|
error[E0405]: cannot find trait `Iterator` in this scope
@ -31,7 +29,6 @@ LL | impl Iterator for Test {}
help: consider importing this trait
|
LL + use std::iter::Iterator;
LL | struct Test;
|
error[E0405]: cannot find trait `ToString` in this scope
@ -43,7 +40,6 @@ LL | impl ToString for Test {}
help: consider importing this trait
|
LL + use std::string::ToString;
LL | struct Test;
|
error[E0405]: cannot find trait `Writer` in this scope
@ -61,7 +57,6 @@ LL | drop(2)
help: consider importing this function
|
LL + use std::mem::drop;
LL | struct Test;
|
error: aborting due to 6 previous errors

View file

@ -85,10 +85,8 @@ LL | let _: E = m::f;
help: consider importing one of these items instead
|
LL + use std::f32::consts::E;
LL | use m::E; // OK, only the type is imported
|
LL + use std::f64::consts::E;
LL | use m::E; // OK, only the type is imported
|
help: if you import `E`, refer to it directly
|
@ -124,10 +122,8 @@ LL | let _: E = (E::Fn(/* fields */));
help: consider importing one of these items instead
|
LL + use std::f32::consts::E;
LL | use m::E; // OK, only the type is imported
|
LL + use std::f64::consts::E;
LL | use m::E; // OK, only the type is imported
|
error[E0412]: cannot find type `Z` in this scope

View file

@ -13,7 +13,6 @@ LL | let _: ::u8;
help: consider importing this builtin type
|
LL + use std::primitive::u8;
LL | fn main() {
|
help: if you import `u8`, refer to it directly
|

View file

@ -7,7 +7,6 @@ LL | let x1 = HashMap::new();
help: consider importing this struct
|
LL + use std::collections::HashMap;
LL | fn main() {
|
error[E0412]: cannot find type `HashMap` in this scope
@ -19,7 +18,6 @@ LL | let y1: HashMap;
help: consider importing this struct
|
LL + use std::collections::HashMap;
LL | fn main() {
|
error[E0412]: cannot find type `GooMap` in this scope

View file

@ -7,7 +7,6 @@ LL | type Bar = Path;
help: consider importing this struct
|
LL + use std::path::Path;
LL | #[derive(Debug)]
|
error[E0425]: cannot find value `A` in this scope
@ -19,7 +18,6 @@ LL | let _ = A;
help: consider importing this constant
|
LL + use m::A;
LL | macro_rules! y {
|
error[E0412]: cannot find type `HashMap` in this scope
@ -31,7 +29,6 @@ LL | type Dict<K, V> = HashMap<K, V>;
help: consider importing this struct
|
LL + use std::collections::HashMap;
LL | macro_rules! y {
|
error: aborting due to 3 previous errors

View file

@ -7,16 +7,12 @@ LL | let _d = Drain {};
help: consider importing one of these items
|
LL + use crate::plumbing::Drain;
LL | mod plumbing {
|
LL + use std::collections::binary_heap::Drain;
LL | mod plumbing {
|
LL + use std::collections::hash_map::Drain;
LL | mod plumbing {
|
LL + use std::collections::hash_set::Drain;
LL | mod plumbing {
|
and 3 other candidates

View file

@ -11,7 +11,6 @@ LL | x.foobar();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use crate::foo::foobar::Foobar;
LL | mod foobar {
|
error[E0599]: no method named `bar` found for type `u32` in the current scope
@ -27,7 +26,6 @@ LL | x.bar();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use crate::foo::Bar;
LL | mod foo {
|
error[E0599]: no method named `baz` found for type `u32` in the current scope
@ -46,7 +44,6 @@ LL | let y = u32::from_str("33");
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use std::str::FromStr;
LL | mod foo {
|
help: there is an associated function with a similar name
|

View file

@ -11,7 +11,6 @@ LL | A::deserialize();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use <crate::A as issue_87932_a::Deserialize>::deserialize::_a::Deserialize;
LL | pub struct A {}
|
error: aborting due to previous error

View file

@ -9,10 +9,8 @@ LL | let _: u32 = 3u8.try_into().unwrap();
help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
|
LL + use crate::m::TryIntoU32;
LL | use crate::m::AnotherTrick as TryIntoU32;
|
LL + use std::convert::TryInto;
LL | use crate::m::AnotherTrick as TryIntoU32;
|
error: aborting due to previous error

View file

@ -17,7 +17,6 @@ LL | self.sleep();
help: consider importing this function
|
LL + use std::thread::sleep;
LL | struct Cat {
|
error: aborting due to 2 previous errors

View file

@ -11,7 +11,6 @@ LL | ().f()
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use foo::T;
LL | mod foo {
|
error: aborting due to previous error

View file

@ -16,7 +16,6 @@ LL | interval: Duration,
help: consider importing this struct
|
LL + use std::time::Duration;
LL | fn main() {}
|
error: aborting due to 2 previous errors

View file

@ -12,7 +12,6 @@ LL | impl<T: Clone, Add> Add for Foo<T> {
help: consider importing this trait instead
|
LL + use std::ops::Add;
LL | use std::ops::Add;
|
error: aborting due to previous error

View file

@ -7,10 +7,8 @@ LL | let _x = NonZeroU32::new(5).unwrap();
help: consider importing one of these items
|
LL + use core::num::NonZeroU32;
LL | fn main() {
|
LL + use std::num::NonZeroU32;
LL | fn main() {
|
error: aborting due to previous error

View file

@ -11,10 +11,8 @@ LL | banana::Chaenomeles.pick()
help: the following traits are implemented but not in scope; perhaps add a `use` for one of them:
|
LL + use banana::Apple;
LL | mod banana {
|
LL + use banana::Peach;
LL | mod banana {
|
error: aborting due to previous error

View file

@ -11,7 +11,6 @@ LL | h.finish()
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use std::hash::Hasher;
LL | use std::hash::BuildHasher;
|
error[E0599]: the method `as_ref` exists for reference `&dyn Bar`, but its trait bounds were not satisfied

View file

@ -7,7 +7,6 @@ LL | type Output = Option<Foo>;
help: consider importing this struct
|
LL + use foo::Foo;
LL | extern crate foo;
|
error: aborting due to previous error

View file

@ -29,7 +29,6 @@ LL | r#break();
help: consider importing this function
|
LL + use foo::r#break;
LL | mod foo {
|
error: aborting due to 3 previous errors

View file

@ -9,10 +9,8 @@ LL | let _i: i16 = TryFrom::try_from(0_i32).unwrap();
help: consider importing one of these items
|
LL + use core::convert::TryFrom;
LL | fn test() {
|
LL + use std::convert::TryFrom;
LL | fn test() {
|
error[E0433]: failed to resolve: use of undeclared type `TryInto`
@ -26,10 +24,8 @@ LL | let _i: i16 = TryInto::try_into(0_i32).unwrap();
help: consider importing one of these items
|
LL + use core::convert::TryInto;
LL | fn test() {
|
LL + use std::convert::TryInto;
LL | fn test() {
|
error[E0433]: failed to resolve: use of undeclared type `FromIterator`
@ -47,10 +43,8 @@ LL | let _v: Vec<_> = IntoIterator::from_iter(&[1]);
help: consider importing one of these items
|
LL + use core::iter::FromIterator;
LL | fn test() {
|
LL + use std::iter::FromIterator;
LL | fn test() {
|
error[E0599]: no method named `try_into` found for type `i32` in the current scope
@ -67,7 +61,6 @@ LL | let _i: i16 = 0_i32.try_into().unwrap();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use std::convert::TryInto;
LL | fn test() {
|
error: aborting due to 4 previous errors

View file

@ -7,7 +7,6 @@ LL | fn foobar<T: Debug>(x: T) {}
help: consider importing this trait instead
|
LL + use std::fmt::Debug;
LL | fn main() {}
|
error: aborting due to previous error

View file

@ -14,7 +14,6 @@ LL | pub struct S;
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use m::Foo;
LL | fn main() {
|
error: aborting due to previous error

View file

@ -7,7 +7,6 @@ LL | T: Into<Cow<'static, str>>,
help: consider importing this enum
|
LL + use std::borrow::Cow;
LL | pub enum LabelText {
|
error[E0119]: conflicting implementations of trait `From<LabelText>` for type `LabelText`

View file

@ -7,7 +7,6 @@ LL | pub struct A<H: A::Trait>(pub H);
help: consider importing this trait
|
LL + use A::Trait;
LL | pub struct A<H: A::Trait>(pub H);
|
help: if you import `Trait`, refer to it directly
|

View file

@ -7,7 +7,6 @@ LL | struct Smaht<T, MISC>(PhantomData);
help: consider importing this struct
|
LL + use std::marker::PhantomData;
LL | use std::ops::DispatchFromDyn;
|
error[E0412]: cannot find type `U` in this scope

View file

@ -30,7 +30,6 @@ LL | S.b();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use method::B;
LL | struct S;
|
error[E0624]: method `a` is private
@ -71,7 +70,6 @@ LL | S::b(&S);
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use method::B;
LL | struct S;
|
error[E0624]: method `a` is private
@ -112,7 +110,6 @@ LL | S::B;
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use assoc_const::B;
LL | struct S;
|
error[E0624]: associated constant `A` is private

View file

@ -11,7 +11,6 @@ LL | foo.method();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use inner::Bar;
LL | mod inner {
|
error: aborting due to previous error

View file

@ -13,7 +13,6 @@ LL | fn a(&self) {}
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use xcrate_issue_43189_b::xcrate_issue_43189_a::A;
LL | extern crate xcrate_issue_43189_b;
|
error: aborting due to previous error

View file

@ -8,7 +8,6 @@ LL | x.deref();
help: the following trait is implemented but not in scope; perhaps add a `use` for it:
|
LL + use std::ops::Deref;
LL | use crate::b::Shadow as _; // Only imports the struct
|
error: aborting due to previous error

View file

@ -18,7 +18,6 @@ LL | impl Trait for () {}
help: consider importing this trait
|
LL + use a::Trait;
LL | impl Trait for () {}
|
error: aborting due to 2 previous errors