use rustc_infer::infer::TyCtxtInferExt;
use rustc_lint::{LateContext, LateLintPass};
use rustc_middle::mir::FakeReadCause;
-use rustc_middle::ty::{self, TypeFoldable};
+use rustc_middle::ty::{self, TypeVisitable};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use rustc_span::symbol::kw;
use rustc_span::{sym, Span};
}
impl<'tcx> LateLintPass<'tcx> for NeedlessPassByValue {
- #[allow(clippy::too_many_lines)]
+ #[expect(clippy::too_many_lines)]
fn check_fn(
&mut self,
cx: &LateContext<'tcx>,
}
match kind {
- FnKind::ItemFn(.., header, _) => {
+ FnKind::ItemFn(.., header) => {
let attrs = cx.tcx.hir().attrs(hir_id);
if header.abi != Abi::Rust || requires_exact_signature(attrs) {
return;
|x| Cow::from(format!("change `{}` to", x)),
)
.as_ref(),
- suggestion.into(),
+ suggestion,
Applicability::Unspecified,
);
}
diag.span_suggestion(
input.span,
"consider changing the type to",
- "&str".to_string(),
+ "&str",
Applicability::Unspecified,
);
|x| Cow::from(format!("change `{}` to", x))
)
.as_ref(),
- suggestion.into(),
+ suggestion,
Applicability::Unspecified,
);
}
fn mutate(&mut self, _: &euv::PlaceWithHirId<'tcx>, _: HirId) {}
- fn fake_read(&mut self, _: rustc_typeck::expr_use_visitor::Place<'tcx>, _: FakeReadCause, _: HirId) {}
+ fn fake_read(&mut self, _: &rustc_typeck::expr_use_visitor::PlaceWithHirId<'tcx>, _: FakeReadCause, _: HirId) {}
}