Skip to content

Commit 1c6a061

Browse files
committed
Auto merge of rust-lang#119009 - workingjubilee:rollup-ytexy6j, r=workingjubilee
Rollup of 6 pull requests Successful merges: - rust-lang#118523 (Add ASCII whitespace trimming functions to `&str`) - rust-lang#118851 ([std] Add xcoff in object's feature list) - rust-lang#118989 (Simplify lint decorator derive too) - rust-lang#118993 (use `if cfg!` instead of `#[cfg]`) - rust-lang#119003 (NFC: do not clone types that are copy) - rust-lang#119004 (NFC don't convert types to identical types) r? `@ghost` `@rustbot` modify labels: rollup
2 parents 5c927ab + c5a3d98 commit 1c6a061

File tree

37 files changed

+146
-128
lines changed

37 files changed

+146
-128
lines changed

compiler/rustc_ast_lowering/src/expr.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,9 +1260,7 @@ impl<'hir> LoweringContext<'_, 'hir> {
12601260
);
12611261

12621262
// `a = lhs1; b = lhs2;`.
1263-
let stmts = self
1264-
.arena
1265-
.alloc_from_iter(std::iter::once(destructure_let).chain(assignments.into_iter()));
1263+
let stmts = self.arena.alloc_from_iter(std::iter::once(destructure_let).chain(assignments));
12661264

12671265
// Wrap everything in a block.
12681266
hir::ExprKind::Block(self.block_all(whole_span, stmts, None), None)

compiler/rustc_codegen_llvm/src/builder.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ impl<'a, 'll, 'tcx> BuilderMethods<'a, 'tcx> for Builder<'a, 'll, 'tcx> {
353353
let new_kind = match ty.kind() {
354354
Int(t @ Isize) => Int(t.normalize(self.tcx.sess.target.pointer_width)),
355355
Uint(t @ Usize) => Uint(t.normalize(self.tcx.sess.target.pointer_width)),
356-
t @ (Uint(_) | Int(_)) => t.clone(),
356+
t @ (Uint(_) | Int(_)) => *t,
357357
_ => panic!("tried to get overflow intrinsic for op applied to non-int type"),
358358
};
359359

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ pub fn file_metadata<'ll>(cx: &CodegenCx<'ll, '_>, source_file: &SourceFile) ->
607607

608608
if let Ok(rel_path) = abs_path.strip_prefix(working_directory) {
609609
(
610-
working_directory.to_string_lossy().into(),
610+
working_directory.to_string_lossy(),
611611
rel_path.to_string_lossy().into_owned(),
612612
)
613613
} else {

compiler/rustc_codegen_llvm/src/debuginfo/metadata/enums/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ pub fn build_coroutine_variant_struct_type_di_node<'ll, 'tcx>(
396396
})
397397
.collect();
398398

399-
state_specific_fields.into_iter().chain(common_fields.into_iter()).collect()
399+
state_specific_fields.into_iter().chain(common_fields).collect()
400400
},
401401
|cx| build_generic_type_param_di_nodes(cx, coroutine_type_and_layout.ty),
402402
)

compiler/rustc_data_structures/src/sorted_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ impl<K: Ord, V> SortedMap<K, V> {
198198
if index == self.data.len() || elements.last().unwrap().0 < self.data[index].0 {
199199
// We can copy the whole range without having to mix with
200200
// existing elements.
201-
self.data.splice(index..index, elements.into_iter());
201+
self.data.splice(index..index, elements);
202202
return;
203203
}
204204

compiler/rustc_errors/src/diagnostic.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,7 @@ where
9191
#[rustc_diagnostic_item = "DecorateLint"]
9292
pub trait DecorateLint<'a, G: EmissionGuarantee> {
9393
/// Decorate and emit a lint.
94-
fn decorate_lint<'b>(
95-
self,
96-
diag: &'b mut DiagnosticBuilder<'a, G>,
97-
) -> &'b mut DiagnosticBuilder<'a, G>;
94+
fn decorate_lint<'b>(self, diag: &'b mut DiagnosticBuilder<'a, G>);
9895

9996
fn msg(&self) -> DiagnosticMessage;
10097
}

compiler/rustc_errors/src/emitter.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2677,10 +2677,7 @@ fn from_stderr(color: ColorConfig) -> Destination {
26772677
/// On Windows, BRIGHT_BLUE is hard to read on black. Use cyan instead.
26782678
///
26792679
/// See #36178.
2680-
#[cfg(windows)]
2681-
const BRIGHT_BLUE: Color = Color::Cyan;
2682-
#[cfg(not(windows))]
2683-
const BRIGHT_BLUE: Color = Color::Blue;
2680+
const BRIGHT_BLUE: Color = if cfg!(windows) { Color::Cyan } else { Color::Blue };
26842681

26852682
impl Style {
26862683
fn color_spec(&self, lvl: Level) -> ColorSpec {

compiler/rustc_hir/src/hir.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,7 +1557,7 @@ impl Expr<'_> {
15571557
ExprKind::Call(..) => ExprPrecedence::Call,
15581558
ExprKind::MethodCall(..) => ExprPrecedence::MethodCall,
15591559
ExprKind::Tup(_) => ExprPrecedence::Tup,
1560-
ExprKind::Binary(op, ..) => ExprPrecedence::Binary(op.node.into()),
1560+
ExprKind::Binary(op, ..) => ExprPrecedence::Binary(op.node),
15611561
ExprKind::Unary(..) => ExprPrecedence::Unary,
15621562
ExprKind::Lit(_) => ExprPrecedence::Lit,
15631563
ExprKind::Type(..) | ExprKind::Cast(..) => ExprPrecedence::Cast,
@@ -1697,11 +1697,9 @@ impl Expr<'_> {
16971697
// them being used only for its side-effects.
16981698
base.can_have_side_effects()
16991699
}
1700-
ExprKind::Struct(_, fields, init) => fields
1701-
.iter()
1702-
.map(|field| field.expr)
1703-
.chain(init.into_iter())
1704-
.any(|e| e.can_have_side_effects()),
1700+
ExprKind::Struct(_, fields, init) => {
1701+
fields.iter().map(|field| field.expr).chain(init).any(|e| e.can_have_side_effects())
1702+
}
17051703

17061704
ExprKind::Array(args)
17071705
| ExprKind::Tup(args)

compiler/rustc_hir_analysis/src/collect/resolve_bound_vars.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ impl<'a, 'tcx> BoundVarContext<'a, 'tcx> {
350350
// Nested poly trait refs have the binders concatenated
351351
let mut full_binders =
352352
self.map.late_bound_vars.entry(*hir_id).or_default().clone();
353-
full_binders.extend(supertrait_bound_vars.into_iter());
353+
full_binders.extend(supertrait_bound_vars);
354354
break (full_binders, BinderScopeType::Concatenating);
355355
}
356356
}

compiler/rustc_hir_typeck/src/errors.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,13 +573,13 @@ impl rustc_errors::AddToDiagnostic for CastUnknownPointerSub {
573573
{
574574
match self {
575575
CastUnknownPointerSub::To(span) => {
576-
let msg = f(diag, crate::fluent_generated::hir_typeck_label_to.into());
576+
let msg = f(diag, crate::fluent_generated::hir_typeck_label_to);
577577
diag.span_label(span, msg);
578-
let msg = f(diag, crate::fluent_generated::hir_typeck_note.into());
578+
let msg = f(diag, crate::fluent_generated::hir_typeck_note);
579579
diag.note(msg);
580580
}
581581
CastUnknownPointerSub::From(span) => {
582-
let msg = f(diag, crate::fluent_generated::hir_typeck_label_from.into());
582+
let msg = f(diag, crate::fluent_generated::hir_typeck_label_from);
583583
diag.span_label(span, msg);
584584
}
585585
}

0 commit comments

Comments
 (0)