use crate::utils::span_lint;
-use rustc::ty::subst::Subst;
-use rustc::ty::{self, Ty};
-use rustc_hir::{print, BorrowKind, Expr, ExprKind, Mutability};
+use rustc_hir::{BorrowKind, Expr, ExprKind, Mutability};
use rustc_lint::{LateContext, LateLintPass};
+use rustc_middle::ty::subst::Subst;
+use rustc_middle::ty::{self, Ty};
use rustc_session::{declare_lint_pass, declare_tool_lint};
declare_clippy_lint! {
- /// **What it does:** Detects giving a mutable reference to a function that only
+ /// **What it does:** Detects passing a mutable reference to a function that only
/// requires an immutable reference.
///
/// **Why is this bad?** The immutable reference rules out all other references
///
/// **Example:**
/// ```ignore
+ /// // Bad
/// my_vec.push(&mut value)
+ ///
+ /// // Good
+ /// my_vec.push(&value)
/// ```
pub UNNECESSARY_MUT_PASSED,
style,
cx,
arguments,
cx.tables.expr_ty(fn_expr),
- &print::to_string(print::NO_ANN, |s| s.print_qpath(path, false)),
+ &rustc_hir_pretty::to_string(rustc_hir_pretty::NO_ANN, |s| s.print_qpath(path, false)),
);
}
},