Skip to content

Commit b96d9e0

Browse files
committed
Auto merge of #105644 - matthiaskrgr:rollup-qc6hlzq, r=matthiaskrgr
Rollup of 8 pull requests Successful merges: - #104864 (Account for item-local in inner scope for E0425) - #105332 (Point out the type of associated types in every method call of iterator chains) - #105620 (Remove unnecessary uses of `clone`) - #105625 (minor code cleanups) - #105629 (rustdoc: stop treating everything in a trait item as a method) - #105636 (Add check for local-storage value when changing "display line numbers" settings) - #105639 (rustdoc: remove `type="text/css" from stylesheet links) - #105640 (Adjust miri to still be optional) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
2 parents ed97493 + 5af0447 commit b96d9e0

File tree

60 files changed

+865
-244
lines changed

Some content is hidden

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

60 files changed

+865
-244
lines changed

compiler/rustc_abi/src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -802,12 +802,9 @@ impl Integer {
802802
pub fn for_align<C: HasDataLayout>(cx: &C, wanted: Align) -> Option<Integer> {
803803
let dl = cx.data_layout();
804804

805-
for candidate in [I8, I16, I32, I64, I128] {
806-
if wanted == candidate.align(dl).abi && wanted.bytes() == candidate.size().bytes() {
807-
return Some(candidate);
808-
}
809-
}
810-
None
805+
[I8, I16, I32, I64, I128].into_iter().find(|&candidate| {
806+
wanted == candidate.align(dl).abi && wanted.bytes() == candidate.size().bytes()
807+
})
811808
}
812809

813810
/// Find the largest integer with the given alignment or less.

compiler/rustc_ast/src/token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ impl Lit {
114114
if let NtExpr(expr) | NtLiteral(expr) = &**nt
115115
&& let ast::ExprKind::Lit(token_lit) = expr.kind =>
116116
{
117-
Some(token_lit.clone())
117+
Some(token_lit)
118118
}
119119
_ => None,
120120
}

compiler/rustc_ast_passes/src/feature_gate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ fn check_incompatible_features(sess: &Session) {
630630
{
631631
let spans = vec![f1_span, f2_span];
632632
sess.struct_span_err(
633-
spans.clone(),
633+
spans,
634634
&format!(
635635
"features `{}` and `{}` are incompatible, using them at the same time \
636636
is not allowed",

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
745745
err.span_suggestion_verbose(
746746
span.shrink_to_hi(),
747747
"consider cloning the value if the performance cost is acceptable",
748-
".clone()".to_string(),
748+
".clone()",
749749
Applicability::MachineApplicable,
750750
);
751751
}

compiler/rustc_builtin_macros/src/alloc_error_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub fn expand(
3232
(item, true, ecx.with_def_site_ctxt(fn_kind.sig.span))
3333
} else {
3434
ecx.sess.parse_sess.span_diagnostic.span_err(item.span(), "alloc_error_handler must be a function");
35-
return vec![orig_item.clone()];
35+
return vec![orig_item];
3636
};
3737

3838
// Generate a bunch of new items using the AllocFnFactory

compiler/rustc_builtin_macros/src/concat_bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ pub fn expand_concat_bytes(
196196
}
197197
}
198198
if !missing_literals.is_empty() {
199-
let mut err = cx.struct_span_err(missing_literals.clone(), "expected a byte literal");
199+
let mut err = cx.struct_span_err(missing_literals, "expected a byte literal");
200200
err.note("only byte literals (like `b\"foo\"`, `b's'`, and `[3, 4, 5]`) can be passed to `concat_bytes!()`");
201201
err.emit();
202202
return base::MacEager::expr(DummyResult::raw_expr(sp, true));

compiler/rustc_codegen_llvm/src/back/lto.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ pub(crate) fn run_thin(
210210
}
211211

212212
pub(crate) fn prepare_thin(module: ModuleCodegen<ModuleLlvm>) -> (String, ThinBuffer) {
213-
let name = module.name.clone();
213+
let name = module.name;
214214
let buffer = ThinBuffer::new(module.module_llvm.llmod(), true);
215215
(name, buffer)
216216
}

compiler/rustc_data_structures/src/base_n.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub const MAX_BASE: usize = 64;
99
pub const ALPHANUMERIC_ONLY: usize = 62;
1010
pub const CASE_INSENSITIVE: usize = 36;
1111

12-
const BASE_64: &[u8; MAX_BASE as usize] =
12+
const BASE_64: &[u8; MAX_BASE] =
1313
b"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@$";
1414

1515
#[inline]

compiler/rustc_errors/src/diagnostic.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,11 @@ impl Diagnostic {
370370
self.set_span(after);
371371
for span_label in before.span_labels() {
372372
if let Some(label) = span_label.label {
373-
self.span.push_span_label(after, label);
373+
if span_label.is_primary {
374+
self.span.push_span_label(after, label);
375+
} else {
376+
self.span.push_span_label(span_label.span, label);
377+
}
374378
}
375379
}
376380
self
@@ -802,7 +806,7 @@ impl Diagnostic {
802806
debug_assert!(
803807
!(suggestions
804808
.iter()
805-
.flat_map(|suggs| suggs)
809+
.flatten()
806810
.any(|(sp, suggestion)| sp.is_empty() && suggestion.is_empty())),
807811
"Span must not be empty and have no suggestion"
808812
);

compiler/rustc_errors/src/emitter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,7 +1308,7 @@ impl EmitterWriter {
13081308
// see how it *looks* with
13091309
// very *weird* formats
13101310
// see?
1311-
for &(ref text, ref style) in msg.iter() {
1311+
for (text, style) in msg.iter() {
13121312
let text = self.translate_message(text, args);
13131313
let lines = text.split('\n').collect::<Vec<_>>();
13141314
if lines.len() > 1 {
@@ -1370,7 +1370,7 @@ impl EmitterWriter {
13701370
buffer.append(0, ": ", header_style);
13711371
label_width += 2;
13721372
}
1373-
for &(ref text, _) in msg.iter() {
1373+
for (text, _) in msg.iter() {
13741374
let text = self.translate_message(text, args);
13751375
// Account for newlines to align output to its label.
13761376
for (line, text) in normalize_whitespace(&text).lines().enumerate() {

0 commit comments

Comments
 (0)