Skip to content

Commit 8232804

Browse files
bors[bot]lnicola
andauthored
Merge #9706
9706: minor: perf and grammar fixes r=lnicola a=lnicola Co-authored-by: Laurențiu Nicola <[email protected]>
2 parents 8a6bac3 + 6369331 commit 8232804

File tree

4 files changed

+7
-12
lines changed

4 files changed

+7
-12
lines changed

crates/hir_ty/src/infer/closure.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,7 @@ impl InferenceContext<'_> {
7575
safety: chalk_ir::Safety::Safe,
7676
variadic: false,
7777
},
78-
substitution: FnSubst(Substitution::from_iter(
79-
&Interner,
80-
sig_tys.clone(),
81-
)),
78+
substitution: FnSubst(Substitution::from_iter(&Interner, sig_tys)),
8279
});
8380
}
8481
}

crates/ide_assists/src/handlers/remove_unused_param.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,10 @@ pub(crate) fn remove_unused_param(acc: &mut Assists, ctx: &AssistContext) -> Opt
5353
}
5454

5555
let mut param_position = func.param_list()?.params().position(|it| it == param)?;
56-
// param_list() does not take self param into consideration, hence this additional check is
57-
// added. There are two cases to handle in this scenario, where functions are
58-
// associative(functions not associative and not containting contain self, are not allowed), in
59-
// this case param position is rightly set. If a method call is present which has self param,
60-
// that needs to be handled and is added below in process_usage function to reduce this increment and
61-
// not consider self param.
56+
// param_list() does not take the self param into consideration, hence this additional check
57+
// is required. For associated functions, param_position is incremented here. For inherent
58+
// calls we revet the increment below, in process_usage, as those calls will not have an
59+
// explicit self parameter.
6260
if is_self_present {
6361
param_position += 1;
6462
}

crates/ide_db/src/path_transform.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'a> Ctx<'a> {
105105
s.param_list().is_some() || (s.self_token().is_some() && path.parent_path().is_none())
106106
}) {
107107
// don't try to qualify `Fn(Foo) -> Bar` paths, they are in prelude anyway
108-
// don't try to qualify sole `self` either, they are usually locals, but are returned as modules due to namespace classing
108+
// don't try to qualify sole `self` either, they are usually locals, but are returned as modules due to namespace clashing
109109
return None;
110110
}
111111

crates/rust-analyzer/src/main_loop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -636,7 +636,7 @@ impl GlobalState {
636636
let mut text = String::from_utf8(vfs.file_contents(file_id).to_vec()).unwrap();
637637
apply_document_changes(&mut text, params.content_changes);
638638

639-
vfs.set_file_contents(path.clone(), Some(text.into_bytes()));
639+
vfs.set_file_contents(path, Some(text.into_bytes()));
640640
}
641641
Ok(())
642642
})?

0 commit comments

Comments
 (0)