Skip to content

Commit f7356f2

Browse files
committed
Fix lint errors
1 parent 41f5ee1 commit f7356f2

File tree

3 files changed

+5
-7
lines changed

3 files changed

+5
-7
lines changed

clippy_lints/src/assigning_clones.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,14 @@ impl<'tcx> LateLintPass<'tcx> for AssigningClones {
6161
};
6262

6363
if is_ok_to_suggest(cx, lhs, &call) {
64-
suggest(cx, assign_expr, lhs, call);
64+
suggest(cx, assign_expr, lhs, &call);
6565
}
6666
}
6767
}
6868

6969
// Try to resolve the call to `Clone::clone` or `ToOwned::to_owned`.
7070
fn extract_call<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) -> Option<CallCandidate<'tcx>> {
71-
let Some(fn_def_id) = clippy_utils::fn_def_id(cx, expr) else {
72-
return None;
73-
};
71+
let fn_def_id = clippy_utils::fn_def_id(cx, expr)?;
7472

7573
// Fast paths to only check method calls without arguments or function calls with a single argument
7674
let (target, kind, resolved_method) = match expr.kind {
@@ -182,7 +180,7 @@ fn suggest<'tcx>(
182180
cx: &LateContext<'tcx>,
183181
assign_expr: &hir::Expr<'tcx>,
184182
lhs: &hir::Expr<'tcx>,
185-
call: CallCandidate<'tcx>,
183+
call: &CallCandidate<'tcx>,
186184
) {
187185
span_lint_and_then(cx, ASSIGNING_CLONES, assign_expr.span, call.message(), |diag| {
188186
let mut applicability = Applicability::MachineApplicable;

clippy_utils/src/sugg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -994,7 +994,7 @@ impl<'tcx> Delegate<'tcx> for DerefDelegate<'_, 'tcx> {
994994
// no adjustment needed here, as field projections are handled by the compiler
995995
ProjectionKind::Field(..) => match cmt.place.ty_before_projection(i).kind() {
996996
ty::Adt(..) | ty::Tuple(_) => {
997-
replacement_str = ident_str_with_proj.clone();
997+
replacement_str.clone_from(&ident_str_with_proj);
998998
projections_handled = true;
999999
},
10001000
_ => (),

tests/missing-test-files.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ fn explore_directory(dir: &Path) -> Vec<String> {
5454
let file_prefix = path.file_prefix().unwrap().to_str().unwrap().to_string();
5555
if let Some(ext) = path.extension() {
5656
match ext.to_str().unwrap() {
57-
"rs" | "toml" => current_file = file_prefix.clone(),
57+
"rs" | "toml" => current_file.clone_from(&file_prefix),
5858
"stderr" | "stdout" => {
5959
if file_prefix != current_file {
6060
missing_files.push(path.to_str().unwrap().to_string());

0 commit comments

Comments
 (0)