Skip to content

Commit ed12887

Browse files
committed
remove needless borrows
1 parent 7705167 commit ed12887

File tree

53 files changed

+87
-87
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+87
-87
lines changed

crates/hir-def/src/data.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ impl<'a> AssocItemCollector<'a> {
542542
if !attrs.is_cfg_enabled(self.expander.cfg_options()) {
543543
self.inactive_diagnostics.push(DefDiagnostic::unconfigured_code(
544544
self.module_id.local_id,
545-
InFile::new(self.expander.current_file_id(), item.ast_id(&item_tree).upcast()),
545+
InFile::new(self.expander.current_file_id(), item.ast_id(item_tree).upcast()),
546546
attrs.cfg().unwrap(),
547547
self.expander.cfg_options().clone(),
548548
));
@@ -551,7 +551,7 @@ impl<'a> AssocItemCollector<'a> {
551551

552552
'attrs: for attr in &*attrs {
553553
let ast_id =
554-
AstId::new(self.expander.current_file_id(), item.ast_id(&item_tree).upcast());
554+
AstId::new(self.expander.current_file_id(), item.ast_id(item_tree).upcast());
555555
let ast_id_with_path = AstIdWithPath { path: (*attr.path).clone(), ast_id };
556556

557557
if let Ok(ResolvedAttr::Macro(call_id)) = self.def_map.resolve_attr_macro(

crates/hir-def/src/find_path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ fn find_path_for_module(
176176

177177
// - if relative paths are fine, check if we are searching for a parent
178178
if prefixed.filter(PrefixKind::is_absolute).is_none() {
179-
if let modpath @ Some(_) = find_self_super(&def_map, module_id, from) {
179+
if let modpath @ Some(_) = find_self_super(def_map, module_id, from) {
180180
return modpath;
181181
}
182182
}

crates/hir-def/src/nameres/collector.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1094,7 +1094,7 @@ impl DefCollector<'_> {
10941094
ast_id,
10951095
*expand_to,
10961096
self.def_map.krate,
1097-
&resolver_def_id,
1097+
resolver_def_id,
10981098
&mut |_err| (),
10991099
);
11001100
if let Ok(Ok(call_id)) = call_id {
@@ -1110,7 +1110,7 @@ impl DefCollector<'_> {
11101110
*derive_attr,
11111111
*derive_pos as u32,
11121112
self.def_map.krate,
1113-
&resolver,
1113+
resolver,
11141114
);
11151115

11161116
if let Ok((macro_id, def_id, call_id)) = id {

crates/hir-expand/src/builtin_attr_macro.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,8 @@ pub fn pseudo_derive_attr_expansion(
115115
};
116116

117117
let mut token_trees = Vec::new();
118-
for tt in (&args.token_trees)
118+
for tt in args
119+
.token_trees
119120
.split(|tt| matches!(tt, tt::TokenTree::Leaf(tt::Leaf::Punct(tt::Punct { char: ',', .. }))))
120121
{
121122
token_trees.push(mk_leaf('#'));

crates/hir-expand/src/name.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ impl<'a> UnescapedName<'a> {
6262
it.clone()
6363
}
6464
}
65-
Repr::TupleField(it) => SmolStr::new(&it.to_string()),
65+
Repr::TupleField(it) => SmolStr::new(it.to_string()),
6666
}
6767
}
6868
}
@@ -139,7 +139,7 @@ impl Name {
139139
pub fn to_smol_str(&self) -> SmolStr {
140140
match &self.0 {
141141
Repr::Text(it) => it.clone(),
142-
Repr::TupleField(it) => SmolStr::new(&it.to_string()),
142+
Repr::TupleField(it) => SmolStr::new(it.to_string()),
143143
}
144144
}
145145

crates/hir-ty/src/consteval.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ pub(crate) fn path_to_const(
404404
args_lazy: impl FnOnce() -> Generics,
405405
debruijn: DebruijnIndex,
406406
) -> Option<Const> {
407-
match resolver.resolve_path_in_value_ns_fully(db.upcast(), &path) {
407+
match resolver.resolve_path_in_value_ns_fully(db.upcast(), path) {
408408
Some(ValueNs::GenericParam(p)) => {
409409
let ty = db.const_param_ty(p);
410410
let args = args_lazy();

crates/hir-ty/src/infer/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1335,7 +1335,7 @@ impl<'a> InferenceContext<'a> {
13351335
ty,
13361336
c,
13371337
ParamLoweringMode::Placeholder,
1338-
|| generics(this.db.upcast(), (&this.resolver).generic_def().unwrap()),
1338+
|| generics(this.db.upcast(), this.resolver.generic_def().unwrap()),
13391339
DebruijnIndex::INNERMOST,
13401340
)
13411341
},

crates/hir-ty/src/infer/pat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ impl<'a> InferenceContext<'a> {
153153
) -> Ty {
154154
let mut expected = self.resolve_ty_shallow(expected);
155155

156-
if is_non_ref_pat(&self.body, pat) {
156+
if is_non_ref_pat(self.body, pat) {
157157
let mut pat_adjustments = Vec::new();
158158
while let Some((inner, _lifetime, mutability)) = expected.as_reference() {
159159
pat_adjustments.push(expected.clone());

crates/hir-ty/src/layout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ pub fn layout_of_ty(db: &dyn HirDatabase, ty: &Ty, krate: CrateId) -> Result<Lay
241241

242242
fn layout_of_unit(cx: &LayoutCx<'_>, dl: &TargetDataLayout) -> Result<Layout, LayoutError> {
243243
cx.univariant::<RustcEnumVariantIdx, &&Layout>(
244-
&dl,
244+
dl,
245245
&[],
246246
&ReprOptions::default(),
247247
StructKind::AlwaysSized,

crates/hir-ty/src/layout/tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ use super::layout_of_ty;
1212
fn eval_goal(ra_fixture: &str, minicore: &str) -> Result<Layout, LayoutError> {
1313
// using unstable cargo features failed, fall back to using plain rustc
1414
let mut cmd = std::process::Command::new("rustc");
15-
cmd.args(&["-Z", "unstable-options", "--print", "target-spec-json"])
16-
.env("RUSTC_BOOTSTRAP", "1");
15+
cmd.args(["-Z", "unstable-options", "--print", "target-spec-json"]).env("RUSTC_BOOTSTRAP", "1");
1716
let output = cmd.output().unwrap();
1817
assert!(output.status.success(), "{}", output.status);
1918
let stdout = String::from_utf8(output.stdout).unwrap();

0 commit comments

Comments
 (0)