diff options
| author | Philipp Krones <hello@philkrones.com> | 2024-11-07 22:31:20 +0100 |
|---|---|---|
| committer | Philipp Krones <hello@philkrones.com> | 2024-11-07 22:37:01 +0100 |
| commit | 6ced8c33c058fa1df65a363abcdc5e2c5828fa66 (patch) | |
| tree | 86a24d4cb4011e4f95093ed710c7bb35cdd95304 /clippy_lints/src/casts | |
| parent | 4847c40c8b40cc2a1155204b934f7a3c29178782 (diff) | |
| download | rust-6ced8c33c058fa1df65a363abcdc5e2c5828fa66.tar.gz rust-6ced8c33c058fa1df65a363abcdc5e2c5828fa66.zip | |
Merge commit 'f712eb5cdccd121d0569af12f20e6a0fabe4364d' into clippy-subtree-update
Diffstat (limited to 'clippy_lints/src/casts')
| -rw-r--r-- | clippy_lints/src/casts/cast_ptr_alignment.rs | 2 | ||||
| -rw-r--r-- | clippy_lints/src/casts/unnecessary_cast.rs | 3 |
2 files changed, 2 insertions, 3 deletions
diff --git a/clippy_lints/src/casts/cast_ptr_alignment.rs b/clippy_lints/src/casts/cast_ptr_alignment.rs index b11b967f8bc..205357afd84 100644 --- a/clippy_lints/src/casts/cast_ptr_alignment.rs +++ b/clippy_lints/src/casts/cast_ptr_alignment.rs @@ -20,7 +20,7 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>) { ); lint_cast_ptr_alignment(cx, expr, cast_from, cast_to); } else if let ExprKind::MethodCall(method_path, self_arg, [], _) = &expr.kind { - if method_path.ident.name == sym!(cast) + if method_path.ident.name.as_str() == "cast" && let Some(generic_args) = method_path.args && let [GenericArg::Type(cast_to)] = generic_args.args // There probably is no obvious reason to do this, just to be consistent with `as` cases. diff --git a/clippy_lints/src/casts/unnecessary_cast.rs b/clippy_lints/src/casts/unnecessary_cast.rs index 811d33c8bde..abd80abffe6 100644 --- a/clippy_lints/src/casts/unnecessary_cast.rs +++ b/clippy_lints/src/casts/unnecessary_cast.rs @@ -268,8 +268,7 @@ fn is_cast_from_ty_alias<'tcx>(cx: &LateContext<'tcx>, expr: impl Visitable<'tcx if !snippet .split("->") .skip(1) - .map(|s| snippet_eq_ty(s, cast_from) || s.split("where").any(|ty| snippet_eq_ty(ty, cast_from))) - .any(|a| a) + .any(|s| snippet_eq_ty(s, cast_from) || s.split("where").any(|ty| snippet_eq_ty(ty, cast_from))) { return ControlFlow::Break(()); } |
