Skip to content

Commit 1bc49a9

Browse files
committed
Simplify
1 parent 4c1cb75 commit 1bc49a9

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/librustc_driver/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1228,7 +1228,7 @@ Available lint options:
12281228
fn sort_lint_groups(lints: Vec<(&'static str, Vec<lint::LintId>, bool)>)
12291229
-> Vec<(&'static str, Vec<lint::LintId>)> {
12301230
let mut lints: Vec<_> = lints.into_iter().map(|(x, y, _)| (x, y)).collect();
1231-
lints.sort_by_key(|ref l| l.0);
1231+
lints.sort_by_key(|l| l.0);
12321232
lints
12331233
}
12341234

src/librustc_driver/profile/trace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ pub fn write_counts(count_file: &mut File, counts: &mut HashMap<String,QueryMetr
208208
for (ref cons, ref qm) in counts.iter() {
209209
data.push((cons.clone(), qm.count.clone(), qm.dur_total.clone(), qm.dur_self.clone()));
210210
};
211-
data.sort_by_key(|&k| Reverse(k.3));
211+
data.sort_by_key(|k| Reverse(k.3));
212212
for (cons, count, dur_total, dur_self) in data {
213213
write!(count_file, "{}, {}, {}, {}\n",
214214
cons, count,

src/librustc_mir/monomorphize/mod.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ pub fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mon
2929
(mono_item, mono_item.symbol_name(tcx))
3030
}).collect();
3131

32-
(&mut symbols[..]).sort_by_key(|&sym| sym.1);
32+
symbols.sort_by_key(|sym| sym.1);
3333

34-
for pair in (&symbols[..]).windows(2) {
34+
for pair in symbols.windows(2) {
3535
let sym1 = &pair[0].1;
3636
let sym2 = &pair[1].1;
3737

38-
if *sym1 == *sym2 {
38+
if sym1 == sym2 {
3939
let mono_item1 = pair[0].0;
4040
let mono_item2 = pair[1].0;
4141

@@ -51,9 +51,7 @@ pub fn assert_symbols_are_distinct<'a, 'tcx, I>(tcx: TyCtxt<'a, 'tcx, 'tcx>, mon
5151
span2
5252
})
5353
}
54-
(Some(span), None) |
55-
(None, Some(span)) => Some(span),
56-
_ => None
54+
(span1, span2) => span1.or(span2),
5755
};
5856

5957
let error_message = format!("symbol `{}` is already defined", sym1);

0 commit comments

Comments
 (0)