diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 85f4ea8b7b9a..ef1432223265 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -184,7 +184,7 @@ fn check_ty(cx: &LateContext, ast_ty: &hir::Ty) { if let Some(def_id) = opt_def_id(def) { if Some(def_id) == cx.tcx.lang_items.owned_box() { if_let_chain! {[ - let &QPath::Resolved(None, ref path) = qpath, + let QPath::Resolved(None, ref path) = *qpath, let [ref bx] = *path.segments, let PathParameters::AngleBracketedParameters(ref ab_data) = bx.parameters, let [ref inner] = *ab_data.types diff --git a/clippy_tests/examples/borrow_box.stderr b/clippy_tests/examples/borrow_box.stderr index 1b4b2c1efa65..1b354dd81df9 100644 --- a/clippy_tests/examples/borrow_box.stderr +++ b/clippy_tests/examples/borrow_box.stderr @@ -1,25 +1,20 @@ error: you seem to be trying to use `&Box`. Consider using just `&T` - --> borrow_box.rs:10:19 - | -10 | pub fn test1(foo: &Box) { //~ ERROR you seem to be trying to use `&Box` - | ^^^^^^^^^^ - | - = note: #[deny(borrowed_box)] implied by #[deny(clippy)] + --> borrow_box.rs:9:19 + | +9 | pub fn test1(foo: &mut Box) { + | ^^^^^^^^^^^^^^ help: try `&mut bool` + | note: lint level defined here - --> borrow_box.rs:4:9 - | -4 | #![deny(clippy)] - | ^^^^^^ - = help: replace `&Box` with simply `&T` + --> borrow_box.rs:4:9 + | +4 | #![deny(borrowed_box)] + | ^^^^^^^^^^^^ error: you seem to be trying to use `&Box`. Consider using just `&T` - --> borrow_box.rs:19:10 + --> borrow_box.rs:18:10 | -19 | foo: &'a Box //~ ERROR you seem to be trying to use `&Box` - | ^^^^^^^^^^^^^ - | - = note: #[deny(borrowed_box)] implied by #[deny(clippy)] - = help: replace `&Box` with simply `&T` +18 | foo: &'a Box + | ^^^^^^^^^^^^^ help: try `&'a bool` error: aborting due to previous error(s)