Skip to content

Commit 2237977

Browse files
authored
Rollup merge of #105875 - matthiaskrgr:needless_borrowed_reference, r=oli-obk
don't destuct references just to reborrow
2 parents 8892698 + a108d55 commit 2237977

File tree

22 files changed

+41
-42
lines changed

22 files changed

+41
-42
lines changed

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ fn thin_lto(
425425
info!("going for that thin, thin LTO");
426426

427427
let green_modules: FxHashMap<_, _> =
428-
cached_modules.iter().map(|&(_, ref wp)| (wp.cgu_name.clone(), wp.clone())).collect();
428+
cached_modules.iter().map(|(_, wp)| (wp.cgu_name.clone(), wp.clone())).collect();
429429

430430
let full_scope_len = modules.len() + serialized_modules.len() + cached_modules.len();
431431
let mut thin_buffers = Vec::with_capacity(modules.len());

compiler/rustc_codegen_ssa/src/back/link.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ fn link_natively<'a>(
722722

723723
linker::disable_localization(&mut cmd);
724724

725-
for &(ref k, ref v) in sess.target.link_env.as_ref() {
725+
for (k, v) in sess.target.link_env.as_ref() {
726726
cmd.env(k.as_ref(), v.as_ref());
727727
}
728728
for k in sess.target.link_env_remove.as_ref() {

compiler/rustc_codegen_ssa/src/back/linker.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ pub fn get_linker<'a>(
108108
if sess.target.is_like_msvc {
109109
if let Some(ref tool) = msvc_tool {
110110
cmd.args(tool.args());
111-
for &(ref k, ref v) in tool.env() {
111+
for (k, v) in tool.env() {
112112
if k == "PATH" {
113113
new_path.extend(env::split_paths(v));
114114
msvc_changed_path = true;

compiler/rustc_const_eval/src/interpret/cast.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
332332
Immediate::new_slice(ptr, length.eval_usize(*self.tcx, self.param_env), self);
333333
self.write_immediate(val, dest)
334334
}
335-
(&ty::Dynamic(ref data_a, ..), &ty::Dynamic(ref data_b, ..)) => {
335+
(ty::Dynamic(data_a, ..), ty::Dynamic(data_b, ..)) => {
336336
let val = self.read_immediate(src)?;
337337
if data_a.principal() == data_b.principal() {
338338
// A NOP cast that doesn't actually change anything, should be allowed even with mismatching vtables.

compiler/rustc_expand/src/mbe/macro_check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ fn check_nested_occurrences(
468468
// We check that the meta-variable is correctly used.
469469
check_occurrences(sess, node_id, tt, macros, binders, ops, valid);
470470
}
471-
(NestedMacroState::MacroName, &TokenTree::Delimited(_, ref del))
471+
(NestedMacroState::MacroName, TokenTree::Delimited(_, del))
472472
if del.delim == Delimiter::Parenthesis =>
473473
{
474474
state = NestedMacroState::MacroNameParen;
@@ -483,7 +483,7 @@ fn check_nested_occurrences(
483483
valid,
484484
);
485485
}
486-
(NestedMacroState::MacroNameParen, &TokenTree::Delimited(_, ref del))
486+
(NestedMacroState::MacroNameParen, TokenTree::Delimited(_, del))
487487
if del.delim == Delimiter::Brace =>
488488
{
489489
state = NestedMacroState::Empty;

compiler/rustc_expand/src/mbe/macro_rules.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,7 @@ impl<'tt> FirstSets<'tt> {
792792
TokenTree::Sequence(sp, ref seq_rep) => {
793793
let subfirst_owned;
794794
let subfirst = match self.first.get(&sp.entire()) {
795-
Some(&Some(ref subfirst)) => subfirst,
795+
Some(Some(subfirst)) => subfirst,
796796
Some(&None) => {
797797
subfirst_owned = self.first(&seq_rep.tts);
798798
&subfirst_owned

compiler/rustc_hir_typeck/src/demand.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1275,7 +1275,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12751275
};
12761276

12771277
match (&expected_ty.kind(), &checked_ty.kind()) {
1278-
(&ty::Int(ref exp), &ty::Int(ref found)) => {
1278+
(ty::Int(exp), ty::Int(found)) => {
12791279
let (f2e_is_fallible, e2f_is_fallible) = match (exp.bit_width(), found.bit_width())
12801280
{
12811281
(Some(exp), Some(found)) if exp < found => (true, false),
@@ -1288,7 +1288,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
12881288
suggest_to_change_suffix_or_into(err, f2e_is_fallible, e2f_is_fallible);
12891289
true
12901290
}
1291-
(&ty::Uint(ref exp), &ty::Uint(ref found)) => {
1291+
(ty::Uint(exp), ty::Uint(found)) => {
12921292
let (f2e_is_fallible, e2f_is_fallible) = match (exp.bit_width(), found.bit_width())
12931293
{
12941294
(Some(exp), Some(found)) if exp < found => (true, false),
@@ -1321,7 +1321,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13211321
suggest_to_change_suffix_or_into(err, f2e_is_fallible, e2f_is_fallible);
13221322
true
13231323
}
1324-
(&ty::Float(ref exp), &ty::Float(ref found)) => {
1324+
(ty::Float(exp), ty::Float(found)) => {
13251325
if found.bit_width() < exp.bit_width() {
13261326
suggest_to_change_suffix_or_into(err, false, true);
13271327
} else if literal_is_ty_suffixed(expr) {
@@ -1357,7 +1357,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13571357
}
13581358
true
13591359
}
1360-
(&ty::Float(ref exp), &ty::Uint(ref found)) => {
1360+
(ty::Float(exp), ty::Uint(found)) => {
13611361
// if `found` is `None` (meaning found is `usize`), don't suggest `.into()`
13621362
if exp.bit_width() > found.bit_width().unwrap_or(256) {
13631363
err.multipart_suggestion_verbose(
@@ -1386,7 +1386,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13861386
}
13871387
true
13881388
}
1389-
(&ty::Float(ref exp), &ty::Int(ref found)) => {
1389+
(ty::Float(exp), ty::Int(found)) => {
13901390
// if `found` is `None` (meaning found is `isize`), don't suggest `.into()`
13911391
if exp.bit_width() > found.bit_width().unwrap_or(256) {
13921392
err.multipart_suggestion_verbose(

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1874,7 +1874,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
18741874
// I don't use 'is_range_literal' because only double-sided, half-open ranges count.
18751875
if let ExprKind::Struct(
18761876
QPath::LangItem(LangItem::Range, ..),
1877-
&[ref range_start, ref range_end],
1877+
[range_start, range_end],
18781878
_,
18791879
) = last_expr_field.expr.kind
18801880
&& let variant_field =

compiler/rustc_hir_typeck/src/fn_ctxt/suggestions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
754754
return true
755755
}
756756
}
757-
&hir::FnRetTy::Return(ref ty) => {
757+
hir::FnRetTy::Return(ty) => {
758758
// Only point to return type if the expected type is the return type, as if they
759759
// are not, the expectation must have been caused by something else.
760760
debug!("suggest_missing_return_type: return type {:?} node {:?}", ty, ty.kind);

compiler/rustc_incremental/src/assert_dep_graph.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ fn dump_graph(query: &DepGraphQuery) {
249249
// dump a .txt file with just the edges:
250250
let txt_path = format!("{}.txt", path);
251251
let mut file = BufWriter::new(File::create(&txt_path).unwrap());
252-
for &(ref source, ref target) in &edges {
252+
for (source, target) in &edges {
253253
write!(file, "{:?} -> {:?}\n", source, target).unwrap();
254254
}
255255
}

0 commit comments

Comments
 (0)