]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/unnecessary_wraps.rs
Auto merge of #9539 - Jarcho:ice_9445, r=flip1995
[rust.git] / clippy_lints / src / unnecessary_wraps.rs
index a5afbb8ff9da49272efd9887b20732ed221c0049..83ef3b0fac8741fb6f46cf8f1c2724f15ddba649 100644 (file)
@@ -115,7 +115,7 @@ fn check_fn(
 
         // Check if all return expression respect the following condition and collect them.
         let mut suggs = Vec::new();
-        let can_sugg = find_all_ret_expressions(cx, &body.value, |ret_expr| {
+        let can_sugg = find_all_ret_expressions(cx, body.value, |ret_expr| {
             if_chain! {
                 if !ret_expr.span.from_expansion();
                 // Check if a function call.
@@ -153,11 +153,8 @@ fn check_fn(
                 )
             } else {
                 (
-                    format!(
-                        "this function's return value is unnecessarily wrapped by `{}`",
-                        return_type_label
-                    ),
-                    format!("remove `{}` from the return type...", return_type_label),
+                    format!("this function's return value is unnecessarily wrapped by `{return_type_label}`"),
+                    format!("remove `{return_type_label}` from the return type..."),
                     inner_type.to_string(),
                     "...and then change returning expressions",
                 )