]> git.lizzy.rs Git - rust.git/blobdiff - clippy_lints/src/map_unit_fn.rs
Auto merge of #5387 - jpospychala:useless_self_fp, r=yaahc
[rust.git] / clippy_lints / src / map_unit_fn.rs
index 5a7950927bb4b55296b51afec48c41cc500de60b..c5bb559e18ea5d2f50042078645a97464cf0071c 100644 (file)
@@ -1,10 +1,10 @@
 use crate::utils::paths;
 use crate::utils::{iter_input_pats, match_type, method_chain_args, snippet, span_lint_and_then};
 use if_chain::if_chain;
-use rustc::lint::{LateContext, LateLintPass};
-use rustc::ty::{self, Ty};
 use rustc_errors::Applicability;
 use rustc_hir as hir;
+use rustc_lint::{LateContext, LateLintPass};
+use rustc_middle::ty::{self, Ty};
 use rustc_session::{declare_lint_pass, declare_tool_lint};
 use rustc_span::source_map::Span;
 
@@ -186,19 +186,19 @@ fn unit_closure<'a, 'tcx>(
 /// `x.field` => `x_field`
 /// `y` => `_y`
 ///
-/// Anything else will return `_`.
+/// Anything else will return `a`.
 fn let_binding_name(cx: &LateContext<'_, '_>, var_arg: &hir::Expr<'_>) -> String {
     match &var_arg.kind {
         hir::ExprKind::Field(_, _) => snippet(cx, var_arg.span, "_").replace(".", "_"),
         hir::ExprKind::Path(_) => format!("_{}", snippet(cx, var_arg.span, "")),
-        _ => "_".to_string(),
+        _ => "a".to_string(),
     }
 }
 
 #[must_use]
 fn suggestion_msg(function_type: &str, map_type: &str) -> String {
     format!(
-        "called `map(f)` on an `{0}` value where `f` is a unit {1}",
+        "called `map(f)` on an `{0}` value where `f` is a {1} that returns the unit type",
         map_type, function_type
     )
 }