X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=clippy_lints%2Fsrc%2Funused_unit.rs;h=52585e59566c8128a6df546b3c00871f096f545f;hb=c07cbb9ea65bb4ed4c78fa4b664474ea234bbc46;hp=1164ac4938fb6a28edce06017a0c0082869eaa83;hpb=f998e89e43776d6b98d3d07a6e52a396b181afff;p=rust.git diff --git a/clippy_lints/src/unused_unit.rs b/clippy_lints/src/unused_unit.rs index 1164ac4938f..52585e59566 100644 --- a/clippy_lints/src/unused_unit.rs +++ b/clippy_lints/src/unused_unit.rs @@ -28,6 +28,7 @@ /// ```rust /// fn return_unit() {} /// ``` + #[clippy::version = "1.31.0"] pub UNUSED_UNIT, style, "needless unit expression" @@ -93,7 +94,7 @@ fn check_poly_trait_ref(&mut self, cx: &EarlyContext<'_>, poly: &ast::PolyTraitR if_chain! { if segments.len() == 1; - if ["Fn", "FnMut", "FnOnce"].contains(&&*segments[0].ident.name.as_str()); + if ["Fn", "FnMut", "FnOnce"].contains(&segments[0].ident.name.as_str()); if let Some(args) = &segments[0].args; if let ast::GenericArgs::Parenthesized(generic_args) = &**args; if let ast::FnRetTy::Ty(ty) = &generic_args.output; @@ -129,7 +130,7 @@ fn lint_unneeded_unit_return(cx: &EarlyContext<'_>, ty: &ast::Ty, span: Span) { snippet_opt(cx, span.with_hi(ty.span.hi())).map_or((ty.span, Applicability::MaybeIncorrect), |fn_source| { position_before_rarrow(&fn_source).map_or((ty.span, Applicability::MaybeIncorrect), |rpos| { ( - #[allow(clippy::cast_possible_truncation)] + #[expect(clippy::cast_possible_truncation)] ty.span.with_lo(BytePos(span.lo().0 + rpos as u32)), Applicability::MachineApplicable, )