diff options
| author | clubby789 <jamie@hill-daniel.co.uk> | 2023-02-27 01:32:07 +0000 |
|---|---|---|
| committer | clubby789 <jamie@hill-daniel.co.uk> | 2023-03-02 02:42:19 +0000 |
| commit | 702a83b1a1ef3a8e85a0d4b56fdfc07f50c13f0d (patch) | |
| tree | 8fa6219e1f16efc0c0399a932e194037a3fae8d8 | |
| parent | 2e2e45a5ba8e878ff917a88f52cb48c5e19eeb0f (diff) | |
| download | rust-702a83b1a1ef3a8e85a0d4b56fdfc07f50c13f0d.tar.gz rust-702a83b1a1ef3a8e85a0d4b56fdfc07f50c13f0d.zip | |
Restrict `#[rustc_box]` to `Box::new` calls
| -rw-r--r-- | clippy_utils/src/higher.rs | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/clippy_utils/src/higher.rs b/clippy_utils/src/higher.rs index 4604ae5c2c7..50bef370930 100644 --- a/clippy_utils/src/higher.rs +++ b/clippy_utils/src/higher.rs @@ -287,15 +287,12 @@ impl<'a> VecArgs<'a> { Some(VecArgs::Repeat(&args[0], &args[1])) } else if match_def_path(cx, fun_def_id, &paths::SLICE_INTO_VEC) && args.len() == 1 { // `vec![a, b, c]` case - if_chain! { - if let hir::ExprKind::Box(boxed) = args[0].kind; - if let hir::ExprKind::Array(args) = boxed.kind; - then { - return Some(VecArgs::Vec(args)); - } + if let hir::ExprKind::Call(_, [arg]) = &args[0].kind + && let hir::ExprKind::Array(args) = arg.kind { + Some(VecArgs::Vec(args)) + } else { + None } - - None } else if match_def_path(cx, fun_def_id, &paths::VEC_NEW) && args.is_empty() { Some(VecArgs::Vec(&[])) } else { |
