Skip to content

Commit 2831e87

Browse files
Review improve docs
1 parent 3f67702 commit 2831e87

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

clippy_lints/src/anon_trait_import.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,31 @@ use rustc_span::symbol::kw;
1010

1111
declare_clippy_lint! {
1212
/// ### What it does
13-
/// Checks for `use Trait` where the Trait is not used directly.
13+
/// Checks for `use Trait` where the Trait is only used for its methods and not referenced by a path directly.
1414
///
1515
/// ### Why is this bad?
16-
/// Traits imported that aren't used directly can be imported anonymously `use Trait as _`. It is more explicit and can be useful to show which imports are required for traits.
16+
/// Traits imported that aren't used directly can be imported anonymously `use Trait as _`.
17+
/// It is more explicit, avoids polutting the current scope with unused names and can be useful to show which imports are required for traits.
1718
///
1819
/// ### Example
1920
/// ```no_run
20-
/// use std::fmt::Write;
21+
/// use std::fmt::Write;
2122
///
22-
/// fn main() {
23-
/// let mut s = String::new();
24-
/// let _ = write!(s, "hello, world!");
25-
/// println!("{s}");
26-
/// }
23+
/// fn main() {
24+
/// let mut s = String::new();
25+
/// let _ = write!(s, "hello, world!");
26+
/// println!("{s}");
27+
/// }
2728
/// ```
2829
/// Use instead:
2930
/// ```no_run
30-
/// use std::fmt::Write as _;
31+
/// use std::fmt::Write as _;
3132
///
32-
/// fn main() {
33-
/// let mut s = String::new();
34-
/// let _ = write!(s, "hello, world!");
35-
/// println!("{s}");
36-
/// }
33+
/// fn main() {
34+
/// let mut s = String::new();
35+
/// let _ = write!(s, "hello, world!");
36+
/// println!("{s}");
37+
/// }
3738
/// ```
3839
#[clippy::version = "1.80.0"]
3940
pub ANON_TRAIT_IMPORT,

0 commit comments

Comments
 (0)