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;
/// `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
)
}