From 9fadcc143a49a124fa1d0d3261593defb986a987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Mon, 10 Apr 2023 16:46:12 +0000 Subject: [PATCH] Special-case item attributes in the suggestion output --- compiler/rustc_errors/src/emitter.rs | 11 ++++++++++- src/tools/clippy/tests/ui/crashes/ice-6252.stderr | 3 --- .../clippy/tests/ui/new_without_default.stderr | 6 ------ tests/ui/coherence/coherence_inherent.stderr | 1 - tests/ui/coherence/coherence_inherent_cc.stderr | 1 - .../generic_const_exprs/issue-94287.stderr | 1 - tests/ui/const-generics/issues/issue-82956.stderr | 4 ---- tests/ui/derived-errors/issue-31997-1.stderr | 1 - .../issue-56028-there-is-an-enum-variant.stderr | 4 ---- tests/ui/hygiene/globs.stderr | 2 -- tests/ui/hygiene/no_implicit_prelude.stderr | 2 -- tests/ui/hygiene/trait_items.stderr | 1 - .../impl-trait/no-method-suggested-traits.stderr | 12 ------------ tests/ui/impl-trait/universal_wrong_bounds.stderr | 2 -- tests/ui/imports/glob-resolve1.stderr | 1 - tests/ui/imports/issue-38293.stderr | 1 - tests/ui/imports/issue-4366-2.stderr | 1 - tests/ui/imports/issue-4366.stderr | 1 - tests/ui/imports/overlapping_pub_trait.stderr | 1 - tests/ui/imports/unnamed_pub_trait.stderr | 1 - tests/ui/issues/issue-10465.stderr | 1 - tests/ui/issues/issue-17546.stderr | 8 -------- tests/ui/issues/issue-35976.unimported.stderr | 1 - tests/ui/issues/issue-37534.stderr | 1 - tests/ui/issues/issue-39175.stderr | 1 - tests/ui/issues/issue-56175.stderr | 2 -- tests/ui/issues/issue-77919.stderr | 1 - tests/ui/layout/issue-84108.stderr | 2 -- tests/ui/macros/issue-100199.stderr | 1 - tests/ui/macros/macro-outer-attributes.stderr | 1 - tests/ui/namespace/namespace-mix.stderr | 8 -------- tests/ui/parser/circular_modules_main.stderr | 1 - tests/ui/privacy/privacy-ns1.stderr | 3 --- tests/ui/privacy/privacy-ns2.stderr | 3 --- tests/ui/proc-macro/amputate-span.stderr | 2 -- .../proc-macro/attributes-on-modules-fail.stderr | 2 -- tests/ui/resolve/crate-in-paths.stderr | 1 - tests/ui/resolve/enums-are-namespaced-xc.stderr | 3 --- tests/ui/resolve/filter-intrinsics.stderr | 2 -- tests/ui/resolve/issue-102946.stderr | 1 - tests/ui/resolve/issue-16058.stderr | 3 --- tests/ui/resolve/issue-17518.stderr | 1 - tests/ui/resolve/issue-21221-1.stderr | 7 ------- tests/ui/resolve/issue-21221-2.stderr | 2 -- tests/ui/resolve/issue-21221-3.stderr | 1 - tests/ui/resolve/issue-21221-4.stderr | 1 - tests/ui/resolve/issue-2356.stderr | 1 - tests/ui/resolve/issue-26545.stderr | 1 - tests/ui/resolve/issue-35675.stderr | 2 -- tests/ui/resolve/issue-3907.stderr | 1 - tests/ui/resolve/issue-50599.stderr | 2 -- tests/ui/resolve/issue-73427.stderr | 2 -- tests/ui/resolve/issue-90113.stderr | 1 - tests/ui/resolve/missing-in-namespace.stderr | 1 - .../ui/resolve/no-implicit-prelude-nested.stderr | 15 --------------- tests/ui/resolve/no-implicit-prelude.stderr | 5 ----- tests/ui/resolve/privacy-enum-ctor.stderr | 4 ---- .../ui/resolve/resolve-primitive-fallback.stderr | 1 - tests/ui/resolve/use_suggestion.stderr | 2 -- tests/ui/resolve/use_suggestion_placement.stderr | 3 --- .../rust-2018/issue-52202-use-suggestions.stderr | 4 ---- .../ui/rust-2018/trait-import-suggestions.stderr | 3 --- .../ui/rust-2018/uniform-paths/issue-87932.stderr | 1 - .../future-prelude-collision-shadow.stderr | 2 -- tests/ui/self/class-missing-self.stderr | 1 - tests/ui/shadowed/shadowed-trait-methods.stderr | 1 - ...021-incompatible-closure-captures-96258.stderr | 1 - tests/ui/span/issue-35987.stderr | 1 - .../core-std-import-order-issue-83564.stderr | 2 -- .../dont-wrap-ambiguous-receivers.stderr | 2 -- .../import-trait-for-method-call.stderr | 1 - .../ui/suggestions/no-extern-crate-in-type.stderr | 1 - .../ui/suggestions/raw-name-use-suggestion.stderr | 1 - .../suggest-tryinto-edition-change.stderr | 7 ------- tests/ui/suggestions/use-placement-resolve.stderr | 1 - tests/ui/suggestions/use-placement-typeck.stderr | 1 - .../impl-bound-with-references-error.stderr | 1 - ...shadowed-path-in-trait-bound-suggestion.stderr | 1 - tests/ui/traits/issue-78372.stderr | 1 - tests/ui/traits/item-privacy.stderr | 3 --- tests/ui/traits/method-private.stderr | 1 - tests/ui/typeck/issue-43189.stderr | 1 - tests/ui/underscore-imports/shadow.stderr | 1 - tests/ui/unresolved/unresolved-candidates.stderr | 1 - 84 files changed, 10 insertions(+), 188 deletions(-) diff --git a/compiler/rustc_errors/src/emitter.rs b/compiler/rustc_errors/src/emitter.rs index 7b6d65511c15b..fe44799efdb6a 100644 --- a/compiler/rustc_errors/src/emitter.rs +++ b/compiler/rustc_errors/src/emitter.rs @@ -1886,6 +1886,7 @@ impl EmitterWriter { } 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 @@ impl EmitterWriter { 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 @@ impl EmitterWriter { 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"); diff --git a/src/tools/clippy/tests/ui/crashes/ice-6252.stderr b/src/tools/clippy/tests/ui/crashes/ice-6252.stderr index 3c7e08ebeae85..4787282f504a6 100644 --- a/src/tools/clippy/tests/ui/crashes/ice-6252.stderr +++ b/src/tools/clippy/tests/ui/crashes/ice-6252.stderr @@ -7,13 +7,10 @@ LL | _n: PhantomData, help: consider importing one of these items | LL + use core::marker::PhantomData; -LL | trait TypeVal { | LL + use serde::__private::PhantomData; -LL | trait TypeVal { | LL + use std::marker::PhantomData; -LL | trait TypeVal { | error[E0412]: cannot find type `VAL` in this scope diff --git a/src/tools/clippy/tests/ui/new_without_default.stderr b/src/tools/clippy/tests/ui/new_without_default.stderr index 9b0a2f6ca5bf2..583dd327d6a5d 100644 --- a/src/tools/clippy/tests/ui/new_without_default.stderr +++ b/src/tools/clippy/tests/ui/new_without_default.stderr @@ -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` @@ -86,7 +82,6 @@ LL + fn default() -> Self { LL + Self::new() LL + } LL + } -LL | impl FooGenerics { | error: you should consider adding a `Default` implementation for `BarGenerics` @@ -104,7 +99,6 @@ LL + fn default() -> Self { LL + Self::new() LL + } LL + } -LL | impl BarGenerics { | error: you should consider adding a `Default` implementation for `Foo` diff --git a/tests/ui/coherence/coherence_inherent.stderr b/tests/ui/coherence/coherence_inherent.stderr index 48f70700046f3..b381b0680734f 100644 --- a/tests/ui/coherence/coherence_inherent.stderr +++ b/tests/ui/coherence/coherence_inherent.stderr @@ -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 diff --git a/tests/ui/coherence/coherence_inherent_cc.stderr b/tests/ui/coherence/coherence_inherent_cc.stderr index 58254740f82e0..7b6cb7d4390b4 100644 --- a/tests/ui/coherence/coherence_inherent_cc.stderr +++ b/tests/ui/coherence/coherence_inherent_cc.stderr @@ -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 diff --git a/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr b/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr index 1e4e4edb596bb..dc7d0c54fcc9a 100644 --- a/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr +++ b/tests/ui/const-generics/generic_const_exprs/issue-94287.stderr @@ -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 diff --git a/tests/ui/const-generics/issues/issue-82956.stderr b/tests/ui/const-generics/issues/issue-82956.stderr index d1d5073255109..d70c8d0bfbf34 100644 --- a/tests/ui/const-generics/issues/issue-82956.stderr +++ b/tests/ui/const-generics/issues/issue-82956.stderr @@ -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; | LL + use std::collections::binary_heap::IntoIter; -LL | pub struct ConstCheck; | LL + use std::collections::btree_map::IntoIter; -LL | pub struct ConstCheck; | LL + use std::collections::btree_set::IntoIter; -LL | pub struct ConstCheck; | and 8 other candidates diff --git a/tests/ui/derived-errors/issue-31997-1.stderr b/tests/ui/derived-errors/issue-31997-1.stderr index 2ea3d910dbfa7..a0262f4c1e597 100644 --- a/tests/ui/derived-errors/issue-31997-1.stderr +++ b/tests/ui/derived-errors/issue-31997-1.stderr @@ -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 diff --git a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr index 11cdcfadef36c..5c610f36322dc 100644 --- a/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr +++ b/tests/ui/did_you_mean/issue-56028-there-is-an-enum-variant.stderr @@ -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 diff --git a/tests/ui/hygiene/globs.stderr b/tests/ui/hygiene/globs.stderr index b68950b66dbae..180172644402b 100644 --- a/tests/ui/hygiene/globs.stderr +++ b/tests/ui/hygiene/globs.stderr @@ -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 diff --git a/tests/ui/hygiene/no_implicit_prelude.stderr b/tests/ui/hygiene/no_implicit_prelude.stderr index 21cecfefd349f..96187b1c50161 100644 --- a/tests/ui/hygiene/no_implicit_prelude.stderr +++ b/tests/ui/hygiene/no_implicit_prelude.stderr @@ -11,7 +11,6 @@ LL | Vec::new(); help: consider importing this struct | LL + use std::vec::Vec; -LL | pub macro m() { Vec::::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::::new(); ().clone() } | error: aborting due to 2 previous errors diff --git a/tests/ui/hygiene/trait_items.stderr b/tests/ui/hygiene/trait_items.stderr index 60cf6787f82fb..f303534c709fc 100644 --- a/tests/ui/hygiene/trait_items.stderr +++ b/tests/ui/hygiene/trait_items.stderr @@ -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 diff --git a/tests/ui/impl-trait/no-method-suggested-traits.stderr b/tests/ui/impl-trait/no-method-suggested-traits.stderr index 0d37ea38b58cd..160cc044078ed 100644 --- a/tests/ui/impl-trait/no-method-suggested-traits.stderr +++ b/tests/ui/impl-trait/no-method-suggested-traits.stderr @@ -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 diff --git a/tests/ui/impl-trait/universal_wrong_bounds.stderr b/tests/ui/impl-trait/universal_wrong_bounds.stderr index 1561708efba37..464d689589e91 100644 --- a/tests/ui/impl-trait/universal_wrong_bounds.stderr +++ b/tests/ui/impl-trait/universal_wrong_bounds.stderr @@ -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 diff --git a/tests/ui/imports/glob-resolve1.stderr b/tests/ui/imports/glob-resolve1.stderr index 6d7ceb25a8fd5..4401ef58732e8 100644 --- a/tests/ui/imports/glob-resolve1.stderr +++ b/tests/ui/imports/glob-resolve1.stderr @@ -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 diff --git a/tests/ui/imports/issue-38293.stderr b/tests/ui/imports/issue-38293.stderr index 7a3b405a78222..1bb7ae29e1083 100644 --- a/tests/ui/imports/issue-38293.stderr +++ b/tests/ui/imports/issue-38293.stderr @@ -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 diff --git a/tests/ui/imports/issue-4366-2.stderr b/tests/ui/imports/issue-4366-2.stderr index d8539f9a9d4fd..412423f4d595e 100644 --- a/tests/ui/imports/issue-4366-2.stderr +++ b/tests/ui/imports/issue-4366-2.stderr @@ -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 diff --git a/tests/ui/imports/issue-4366.stderr b/tests/ui/imports/issue-4366.stderr index 724db83e99ada..4d5b392a7e104 100644 --- a/tests/ui/imports/issue-4366.stderr +++ b/tests/ui/imports/issue-4366.stderr @@ -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 diff --git a/tests/ui/imports/overlapping_pub_trait.stderr b/tests/ui/imports/overlapping_pub_trait.stderr index 268709e11b67c..490dccd3e808e 100644 --- a/tests/ui/imports/overlapping_pub_trait.stderr +++ b/tests/ui/imports/overlapping_pub_trait.stderr @@ -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 diff --git a/tests/ui/imports/unnamed_pub_trait.stderr b/tests/ui/imports/unnamed_pub_trait.stderr index 47fa6d3a39881..5133273c22f6c 100644 --- a/tests/ui/imports/unnamed_pub_trait.stderr +++ b/tests/ui/imports/unnamed_pub_trait.stderr @@ -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 diff --git a/tests/ui/issues/issue-10465.stderr b/tests/ui/issues/issue-10465.stderr index 9941e14a94e06..1b7b9d5909ebb 100644 --- a/tests/ui/issues/issue-10465.stderr +++ b/tests/ui/issues/issue-10465.stderr @@ -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 diff --git a/tests/ui/issues/issue-17546.stderr b/tests/ui/issues/issue-17546.stderr index 23a12fa167b7f..cf7ed1bbd6682 100644 --- a/tests/ui/issues/issue-17546.stderr +++ b/tests/ui/issues/issue-17546.stderr @@ -25,16 +25,12 @@ LL | fn new() -> Result { 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 { 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` diff --git a/tests/ui/issues/issue-35976.unimported.stderr b/tests/ui/issues/issue-35976.unimported.stderr index 8a3e2fcd08333..b31d2a31551ef 100644 --- a/tests/ui/issues/issue-35976.unimported.stderr +++ b/tests/ui/issues/issue-35976.unimported.stderr @@ -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 diff --git a/tests/ui/issues/issue-37534.stderr b/tests/ui/issues/issue-37534.stderr index 8449eb9c6925a..7d3dd8800bd34 100644 --- a/tests/ui/issues/issue-37534.stderr +++ b/tests/ui/issues/issue-37534.stderr @@ -7,7 +7,6 @@ LL | struct Foo { } help: consider importing this trait instead | LL + use std::hash::Hash; -LL | struct Foo { } | warning: default bound relaxed for a type parameter, but this does nothing because the given bound is not a default; only `?Sized` is supported diff --git a/tests/ui/issues/issue-39175.stderr b/tests/ui/issues/issue-39175.stderr index 19e7f5162a77c..3a1476ac0e3af 100644 --- a/tests/ui/issues/issue-39175.stderr +++ b/tests/ui/issues/issue-39175.stderr @@ -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 diff --git a/tests/ui/issues/issue-56175.stderr b/tests/ui/issues/issue-56175.stderr index bedbaef29b9c4..1ddee1f4895bb 100644 --- a/tests/ui/issues/issue-56175.stderr +++ b/tests/ui/issues/issue-56175.stderr @@ -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 diff --git a/tests/ui/issues/issue-77919.stderr b/tests/ui/issues/issue-77919.stderr index 1f3f6cb33c7fb..d6dcc8997b9ab 100644 --- a/tests/ui/issues/issue-77919.stderr +++ b/tests/ui/issues/issue-77919.stderr @@ -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 diff --git a/tests/ui/layout/issue-84108.stderr b/tests/ui/layout/issue-84108.stderr index cdc21df79a7e5..5ad450bed0781 100644 --- a/tests/ui/layout/issue-84108.stderr +++ b/tests/ui/layout/issue-84108.stderr @@ -7,7 +7,6 @@ LL | static FOO: (dyn AsRef, u8) = ("hello", 42); help: consider importing this struct | LL + use std::ffi::OsStr; -LL | static FOO: (dyn AsRef, 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, u8) = ("hello", 42); | error[E0277]: the size for values of type `[u8]` cannot be known at compilation time diff --git a/tests/ui/macros/issue-100199.stderr b/tests/ui/macros/issue-100199.stderr index ab6bc08b5f7c5..89a6f585ce415 100644 --- a/tests/ui/macros/issue-100199.stderr +++ b/tests/ui/macros/issue-100199.stderr @@ -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 diff --git a/tests/ui/macros/macro-outer-attributes.stderr b/tests/ui/macros/macro-outer-attributes.stderr index cfd1c7739ba4c..0bdc3416f807e 100644 --- a/tests/ui/macros/macro-outer-attributes.stderr +++ b/tests/ui/macros/macro-outer-attributes.stderr @@ -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 | diff --git a/tests/ui/namespace/namespace-mix.stderr b/tests/ui/namespace/namespace-mix.stderr index 216548180bc50..3ac5e96c5742b 100644 --- a/tests/ui/namespace/namespace-mix.stderr +++ b/tests/ui/namespace/namespace-mix.stderr @@ -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 | diff --git a/tests/ui/parser/circular_modules_main.stderr b/tests/ui/parser/circular_modules_main.stderr index 2804c6ebf5097..2de70789358b0 100644 --- a/tests/ui/parser/circular_modules_main.stderr +++ b/tests/ui/parser/circular_modules_main.stderr @@ -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 | diff --git a/tests/ui/privacy/privacy-ns1.stderr b/tests/ui/privacy/privacy-ns1.stderr index fe3e4a78a84b0..9710cc48637bc 100644 --- a/tests/ui/privacy/privacy-ns1.stderr +++ b/tests/ui/privacy/privacy-ns1.stderr @@ -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; help: consider importing this trait | LL + use foo1::Bar; -LL | pub mod foo1 { | error[E0747]: constant provided when a type was expected diff --git a/tests/ui/privacy/privacy-ns2.stderr b/tests/ui/privacy/privacy-ns2.stderr index 73a24bd20f33c..75e735e1e6a28 100644 --- a/tests/ui/privacy/privacy-ns2.stderr +++ b/tests/ui/privacy/privacy-ns2.stderr @@ -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 diff --git a/tests/ui/proc-macro/amputate-span.stderr b/tests/ui/proc-macro/amputate-span.stderr index fa83707e79d5b..aa797339be467 100644 --- a/tests/ui/proc-macro/amputate-span.stderr +++ b/tests/ui/proc-macro/amputate-span.stderr @@ -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 diff --git a/tests/ui/proc-macro/attributes-on-modules-fail.stderr b/tests/ui/proc-macro/attributes-on-modules-fail.stderr index a0ab9999c088c..97521f23aeef3 100644 --- a/tests/ui/proc-macro/attributes-on-modules-fail.stderr +++ b/tests/ui/proc-macro/attributes-on-modules-fail.stderr @@ -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 diff --git a/tests/ui/resolve/crate-in-paths.stderr b/tests/ui/resolve/crate-in-paths.stderr index 45ecf5a59adfe..07fb5dcc035c1 100644 --- a/tests/ui/resolve/crate-in-paths.stderr +++ b/tests/ui/resolve/crate-in-paths.stderr @@ -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 diff --git a/tests/ui/resolve/enums-are-namespaced-xc.stderr b/tests/ui/resolve/enums-are-namespaced-xc.stderr index efebf15684b90..5af6cb04275b8 100644 --- a/tests/ui/resolve/enums-are-namespaced-xc.stderr +++ b/tests/ui/resolve/enums-are-namespaced-xc.stderr @@ -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 | diff --git a/tests/ui/resolve/filter-intrinsics.stderr b/tests/ui/resolve/filter-intrinsics.stderr index 3b4a09a25e7f1..cc1092dd0cfa8 100644 --- a/tests/ui/resolve/filter-intrinsics.stderr +++ b/tests/ui/resolve/filter-intrinsics.stderr @@ -7,7 +7,6 @@ LL | let _ = size_of::(); 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 diff --git a/tests/ui/resolve/issue-102946.stderr b/tests/ui/resolve/issue-102946.stderr index 7384384921407..b2cdcb25c3f96 100644 --- a/tests/ui/resolve/issue-102946.stderr +++ b/tests/ui/resolve/issue-102946.stderr @@ -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 diff --git a/tests/ui/resolve/issue-16058.stderr b/tests/ui/resolve/issue-16058.stderr index 65dba047234a2..710002a154efd 100644 --- a/tests/ui/resolve/issue-16058.stderr +++ b/tests/ui/resolve/issue-16058.stderr @@ -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 diff --git a/tests/ui/resolve/issue-17518.stderr b/tests/ui/resolve/issue-17518.stderr index 19b59b841e042..492e3b34a1798 100644 --- a/tests/ui/resolve/issue-17518.stderr +++ b/tests/ui/resolve/issue-17518.stderr @@ -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 diff --git a/tests/ui/resolve/issue-21221-1.stderr b/tests/ui/resolve/issue-21221-1.stderr index 836ea564f4ee1..a38116cd7287a 100644 --- a/tests/ui/resolve/issue-21221-1.stderr +++ b/tests/ui/resolve/issue-21221-1.stderr @@ -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 diff --git a/tests/ui/resolve/issue-21221-2.stderr b/tests/ui/resolve/issue-21221-2.stderr index e88274e6c60b3..9beb626623e4e 100644 --- a/tests/ui/resolve/issue-21221-2.stderr +++ b/tests/ui/resolve/issue-21221-2.stderr @@ -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 diff --git a/tests/ui/resolve/issue-21221-3.stderr b/tests/ui/resolve/issue-21221-3.stderr index e02eaec05e3ec..0dabdfd9b3900 100644 --- a/tests/ui/resolve/issue-21221-3.stderr +++ b/tests/ui/resolve/issue-21221-3.stderr @@ -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 diff --git a/tests/ui/resolve/issue-21221-4.stderr b/tests/ui/resolve/issue-21221-4.stderr index e8c38ed6acf08..5af14b1b68d36 100644 --- a/tests/ui/resolve/issue-21221-4.stderr +++ b/tests/ui/resolve/issue-21221-4.stderr @@ -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 diff --git a/tests/ui/resolve/issue-2356.stderr b/tests/ui/resolve/issue-2356.stderr index ed820f15c83e5..313b3e30dd956 100644 --- a/tests/ui/resolve/issue-2356.stderr +++ b/tests/ui/resolve/issue-2356.stderr @@ -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 diff --git a/tests/ui/resolve/issue-26545.stderr b/tests/ui/resolve/issue-26545.stderr index 2b98b5b8a7bf5..42a7531c5b940 100644 --- a/tests/ui/resolve/issue-26545.stderr +++ b/tests/ui/resolve/issue-26545.stderr @@ -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 diff --git a/tests/ui/resolve/issue-35675.stderr b/tests/ui/resolve/issue-35675.stderr index d285614537158..44af65b0768a8 100644 --- a/tests/ui/resolve/issue-35675.stderr +++ b/tests/ui/resolve/issue-35675.stderr @@ -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` diff --git a/tests/ui/resolve/issue-3907.stderr b/tests/ui/resolve/issue-3907.stderr index 50ad668f8dbf6..70631a13cdf86 100644 --- a/tests/ui/resolve/issue-3907.stderr +++ b/tests/ui/resolve/issue-3907.stderr @@ -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 diff --git a/tests/ui/resolve/issue-50599.stderr b/tests/ui/resolve/issue-50599.stderr index 548d215b00acd..d7419b64facd2 100644 --- a/tests/ui/resolve/issue-50599.stderr +++ b/tests/ui/resolve/issue-50599.stderr @@ -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 | diff --git a/tests/ui/resolve/issue-73427.stderr b/tests/ui/resolve/issue-73427.stderr index 5a663ae79bcb1..622de9b39bde7 100644 --- a/tests/ui/resolve/issue-73427.stderr +++ b/tests/ui/resolve/issue-73427.stderr @@ -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` diff --git a/tests/ui/resolve/issue-90113.stderr b/tests/ui/resolve/issue-90113.stderr index a9d4b573f110b..5f55d9c241a58 100644 --- a/tests/ui/resolve/issue-90113.stderr +++ b/tests/ui/resolve/issue-90113.stderr @@ -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 diff --git a/tests/ui/resolve/missing-in-namespace.stderr b/tests/ui/resolve/missing-in-namespace.stderr index 66f40102a3ed3..7a7b749aebb7b 100644 --- a/tests/ui/resolve/missing-in-namespace.stderr +++ b/tests/ui/resolve/missing-in-namespace.stderr @@ -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 | diff --git a/tests/ui/resolve/no-implicit-prelude-nested.stderr b/tests/ui/resolve/no-implicit-prelude-nested.stderr index 4df6c31d31644..49cf72bfee2d6 100644 --- a/tests/ui/resolve/no-implicit-prelude-nested.stderr +++ b/tests/ui/resolve/no-implicit-prelude-nested.stderr @@ -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 diff --git a/tests/ui/resolve/no-implicit-prelude.stderr b/tests/ui/resolve/no-implicit-prelude.stderr index a8e5f1b69e230..5a759743f7258 100644 --- a/tests/ui/resolve/no-implicit-prelude.stderr +++ b/tests/ui/resolve/no-implicit-prelude.stderr @@ -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 diff --git a/tests/ui/resolve/privacy-enum-ctor.stderr b/tests/ui/resolve/privacy-enum-ctor.stderr index 76dc25539d07d..0bb09090569cb 100644 --- a/tests/ui/resolve/privacy-enum-ctor.stderr +++ b/tests/ui/resolve/privacy-enum-ctor.stderr @@ -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 diff --git a/tests/ui/resolve/resolve-primitive-fallback.stderr b/tests/ui/resolve/resolve-primitive-fallback.stderr index 2227522d6eab6..e3a5d4edcf102 100644 --- a/tests/ui/resolve/resolve-primitive-fallback.stderr +++ b/tests/ui/resolve/resolve-primitive-fallback.stderr @@ -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 | diff --git a/tests/ui/resolve/use_suggestion.stderr b/tests/ui/resolve/use_suggestion.stderr index a30dbd954e12b..1155f5caa1739 100644 --- a/tests/ui/resolve/use_suggestion.stderr +++ b/tests/ui/resolve/use_suggestion.stderr @@ -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 diff --git a/tests/ui/resolve/use_suggestion_placement.stderr b/tests/ui/resolve/use_suggestion_placement.stderr index 9288530ad2e8c..3611f9ae6b4ed 100644 --- a/tests/ui/resolve/use_suggestion_placement.stderr +++ b/tests/ui/resolve/use_suggestion_placement.stderr @@ -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 = HashMap; help: consider importing this struct | LL + use std::collections::HashMap; -LL | macro_rules! y { | error: aborting due to 3 previous errors diff --git a/tests/ui/rust-2018/issue-52202-use-suggestions.stderr b/tests/ui/rust-2018/issue-52202-use-suggestions.stderr index 5450ede822300..9933b92439c13 100644 --- a/tests/ui/rust-2018/issue-52202-use-suggestions.stderr +++ b/tests/ui/rust-2018/issue-52202-use-suggestions.stderr @@ -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 diff --git a/tests/ui/rust-2018/trait-import-suggestions.stderr b/tests/ui/rust-2018/trait-import-suggestions.stderr index 4be5c7b0d0c40..325c5976e7c89 100644 --- a/tests/ui/rust-2018/trait-import-suggestions.stderr +++ b/tests/ui/rust-2018/trait-import-suggestions.stderr @@ -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 | diff --git a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr index e5e17f22c5f17..ac2baa3595bd3 100644 --- a/tests/ui/rust-2018/uniform-paths/issue-87932.stderr +++ b/tests/ui/rust-2018/uniform-paths/issue-87932.stderr @@ -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 ::deserialize::_a::Deserialize; -LL | pub struct A {} | error: aborting due to previous error diff --git a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr index 34bf68e8913f6..9dfaf13e2ecdc 100644 --- a/tests/ui/rust-2021/future-prelude-collision-shadow.stderr +++ b/tests/ui/rust-2021/future-prelude-collision-shadow.stderr @@ -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 diff --git a/tests/ui/self/class-missing-self.stderr b/tests/ui/self/class-missing-self.stderr index 2f35b30dbcb0c..3c37d8197432c 100644 --- a/tests/ui/self/class-missing-self.stderr +++ b/tests/ui/self/class-missing-self.stderr @@ -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 diff --git a/tests/ui/shadowed/shadowed-trait-methods.stderr b/tests/ui/shadowed/shadowed-trait-methods.stderr index 6d7ab27f3e154..1af0400c88619 100644 --- a/tests/ui/shadowed/shadowed-trait-methods.stderr +++ b/tests/ui/shadowed/shadowed-trait-methods.stderr @@ -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 diff --git a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr index 626cc67d9eb93..60433e1c28467 100644 --- a/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr +++ b/tests/ui/span/drop-location-span-error-rust-2021-incompatible-closure-captures-96258.stderr @@ -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 diff --git a/tests/ui/span/issue-35987.stderr b/tests/ui/span/issue-35987.stderr index 0e64bcb010693..88c86d2a91b58 100644 --- a/tests/ui/span/issue-35987.stderr +++ b/tests/ui/span/issue-35987.stderr @@ -12,7 +12,6 @@ LL | impl Add for Foo { help: consider importing this trait instead | LL + use std::ops::Add; -LL | use std::ops::Add; | error: aborting due to previous error diff --git a/tests/ui/suggestions/core-std-import-order-issue-83564.stderr b/tests/ui/suggestions/core-std-import-order-issue-83564.stderr index c87ff95255326..48ee44a74f2d3 100644 --- a/tests/ui/suggestions/core-std-import-order-issue-83564.stderr +++ b/tests/ui/suggestions/core-std-import-order-issue-83564.stderr @@ -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 diff --git a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr index 6eced1d416e48..85fbb8b88e81a 100644 --- a/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr +++ b/tests/ui/suggestions/dont-wrap-ambiguous-receivers.stderr @@ -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 diff --git a/tests/ui/suggestions/import-trait-for-method-call.stderr b/tests/ui/suggestions/import-trait-for-method-call.stderr index 464fe85ac175b..3f54daf136f6d 100644 --- a/tests/ui/suggestions/import-trait-for-method-call.stderr +++ b/tests/ui/suggestions/import-trait-for-method-call.stderr @@ -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 diff --git a/tests/ui/suggestions/no-extern-crate-in-type.stderr b/tests/ui/suggestions/no-extern-crate-in-type.stderr index d8e53229f49fc..68100e56cbc82 100644 --- a/tests/ui/suggestions/no-extern-crate-in-type.stderr +++ b/tests/ui/suggestions/no-extern-crate-in-type.stderr @@ -7,7 +7,6 @@ LL | type Output = Option; help: consider importing this struct | LL + use foo::Foo; -LL | extern crate foo; | error: aborting due to previous error diff --git a/tests/ui/suggestions/raw-name-use-suggestion.stderr b/tests/ui/suggestions/raw-name-use-suggestion.stderr index 733af9079d598..fb070ffc33230 100644 --- a/tests/ui/suggestions/raw-name-use-suggestion.stderr +++ b/tests/ui/suggestions/raw-name-use-suggestion.stderr @@ -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 diff --git a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr index 525a5bc164de0..671f5efddd979 100644 --- a/tests/ui/suggestions/suggest-tryinto-edition-change.stderr +++ b/tests/ui/suggestions/suggest-tryinto-edition-change.stderr @@ -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 diff --git a/tests/ui/suggestions/use-placement-resolve.stderr b/tests/ui/suggestions/use-placement-resolve.stderr index 16cbc9edcef79..77724e7e2a479 100644 --- a/tests/ui/suggestions/use-placement-resolve.stderr +++ b/tests/ui/suggestions/use-placement-resolve.stderr @@ -7,7 +7,6 @@ LL | fn foobar(x: T) {} help: consider importing this trait instead | LL + use std::fmt::Debug; -LL | fn main() {} | error: aborting due to previous error diff --git a/tests/ui/suggestions/use-placement-typeck.stderr b/tests/ui/suggestions/use-placement-typeck.stderr index dc0586302f59b..e900e12b7df0f 100644 --- a/tests/ui/suggestions/use-placement-typeck.stderr +++ b/tests/ui/suggestions/use-placement-typeck.stderr @@ -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 diff --git a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr index cc3b887cf072e..b114d295d7816 100644 --- a/tests/ui/trait-bounds/impl-bound-with-references-error.stderr +++ b/tests/ui/trait-bounds/impl-bound-with-references-error.stderr @@ -7,7 +7,6 @@ LL | T: Into>, help: consider importing this enum | LL + use std::borrow::Cow; -LL | pub enum LabelText { | error[E0119]: conflicting implementations of trait `From` for type `LabelText` diff --git a/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr b/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr index 60a86cc8e41ea..4547e1c984c05 100644 --- a/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr +++ b/tests/ui/trait-bounds/shadowed-path-in-trait-bound-suggestion.stderr @@ -7,7 +7,6 @@ LL | pub struct A(pub H); help: consider importing this trait | LL + use A::Trait; -LL | pub struct A(pub H); | help: if you import `Trait`, refer to it directly | diff --git a/tests/ui/traits/issue-78372.stderr b/tests/ui/traits/issue-78372.stderr index f9c2c0d6dec7d..ec692ff911df5 100644 --- a/tests/ui/traits/issue-78372.stderr +++ b/tests/ui/traits/issue-78372.stderr @@ -7,7 +7,6 @@ LL | struct Smaht(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 diff --git a/tests/ui/traits/item-privacy.stderr b/tests/ui/traits/item-privacy.stderr index f505f36aaeadf..f538131892546 100644 --- a/tests/ui/traits/item-privacy.stderr +++ b/tests/ui/traits/item-privacy.stderr @@ -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 diff --git a/tests/ui/traits/method-private.stderr b/tests/ui/traits/method-private.stderr index 2b047df75a004..e11799308c5c7 100644 --- a/tests/ui/traits/method-private.stderr +++ b/tests/ui/traits/method-private.stderr @@ -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 diff --git a/tests/ui/typeck/issue-43189.stderr b/tests/ui/typeck/issue-43189.stderr index fa8a614362295..c072e6a08ba0b 100644 --- a/tests/ui/typeck/issue-43189.stderr +++ b/tests/ui/typeck/issue-43189.stderr @@ -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 diff --git a/tests/ui/underscore-imports/shadow.stderr b/tests/ui/underscore-imports/shadow.stderr index b0ecf129ca3d7..f2c19405bbb8b 100644 --- a/tests/ui/underscore-imports/shadow.stderr +++ b/tests/ui/underscore-imports/shadow.stderr @@ -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 diff --git a/tests/ui/unresolved/unresolved-candidates.stderr b/tests/ui/unresolved/unresolved-candidates.stderr index 53f63c1c840c9..7ef2f6b1a2922 100644 --- a/tests/ui/unresolved/unresolved-candidates.stderr +++ b/tests/ui/unresolved/unresolved-candidates.stderr @@ -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