File tree 2 files changed +13
-8
lines changed
2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -3609,7 +3609,7 @@ declare_clippy_lint! {
3609
3609
3610
3610
declare_clippy_lint ! {
3611
3611
/// ### What it does
3612
- /// Checks for usage of `as_str()` on a `String`` chained with a method available on the `String` itself.
3612
+ /// Checks for usage of `as_str()` on a `String` chained with a method available on the `String` itself.
3613
3613
///
3614
3614
/// ### Why is this bad?
3615
3615
/// The `as_str()` conversion is pointless and can be removed for simplicity and cleanliness.
@@ -3618,14 +3618,16 @@ declare_clippy_lint! {
3618
3618
/// ```no_run
3619
3619
/// # #![allow(unused)]
3620
3620
/// let owned_string = "This is a string".to_owned();
3621
- /// owned_string.as_str().as_bytes();
3621
+ /// owned_string.as_str().as_bytes()
3622
+ /// # ;
3622
3623
/// ```
3623
3624
///
3624
3625
/// Use instead:
3625
3626
/// ```no_run
3626
3627
/// # #![allow(unused)]
3627
3628
/// let owned_string = "This is a string".to_owned();
3628
- /// owned_string.as_bytes();
3629
+ /// owned_string.as_bytes()
3630
+ /// # ;
3629
3631
/// ```
3630
3632
#[ clippy:: version = "1.74.0" ]
3631
3633
pub REDUNDANT_AS_STR ,
Original file line number Diff line number Diff line change @@ -9,19 +9,22 @@ use rustc_span::sym;
9
9
10
10
declare_clippy_lint ! {
11
11
/// ### What it does
12
- /// Suggest removing the use of a map (or map_err) method when an Option or Result is being constructed.
12
+ /// Suggests removing the use of a `map()` (or `map_err()`) method when an `Option` or `Result`
13
+ /// is being constructed.
13
14
///
14
15
/// ### Why is this bad?
15
- /// It introduces unnecessary complexity. In this case the function can be used directly and
16
- /// construct the Option or Result from the output .
16
+ /// It introduces unnecessary complexity. Instead, the function can be called before
17
+ /// constructing the ` Option` or ` Result` from its return value .
17
18
///
18
19
/// ### Example
19
20
/// ```no_run
20
- /// Some(4).map(i32::swap_bytes);
21
+ /// Some(4).map(i32::swap_bytes)
22
+ /// # ;
21
23
/// ```
22
24
/// Use instead:
23
25
/// ```no_run
24
- /// Some(i32::swap_bytes(4));
26
+ /// Some(i32::swap_bytes(4))
27
+ /// # ;
25
28
/// ```
26
29
#[ clippy:: version = "1.74.0" ]
27
30
pub UNNECESSARY_MAP_ON_CONSTRUCTOR ,
You can’t perform that action at this time.
0 commit comments