Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 6936ca8

Browse files
committed
Auto merge of rust-lang#86311 - LeSeulArtichaut:cleanup-array-iter, r=jackh726
Use the now available implementation of `IntoIterator` for arrays
2 parents 9089771 + e3ca81f commit 6936ca8

File tree

17 files changed

+34
-34
lines changed

17 files changed

+34
-34
lines changed

compiler/rustc_apfloat/tests/ieee.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1939,7 +1939,7 @@ fn add() {
19391939
(m_smallest_normalized, m_smallest_normalized, "-0x1p-125", Status::OK, Category::Normal),
19401940
];
19411941

1942-
for &(x, y, e_result, e_status, e_category) in &special_cases[..] {
1942+
for (x, y, e_result, e_status, e_category) in special_cases {
19431943
let status;
19441944
let result = unpack!(status=, x + y);
19451945
assert_eq!(status, e_status);
@@ -2262,7 +2262,7 @@ fn subtract() {
22622262
(m_smallest_normalized, m_smallest_normalized, "0x0p+0", Status::OK, Category::Zero),
22632263
];
22642264

2265-
for &(x, y, e_result, e_status, e_category) in &special_cases[..] {
2265+
for (x, y, e_result, e_status, e_category) in special_cases {
22662266
let status;
22672267
let result = unpack!(status=, x - y);
22682268
assert_eq!(status, e_status);
@@ -2538,7 +2538,7 @@ fn multiply() {
25382538
(m_smallest_normalized, m_smallest_normalized, "0x0p+0", underflow_status, Category::Zero),
25392539
];
25402540

2541-
for &(x, y, e_result, e_status, e_category) in &special_cases[..] {
2541+
for (x, y, e_result, e_status, e_category) in special_cases {
25422542
let status;
25432543
let result = unpack!(status=, x * y);
25442544
assert_eq!(status, e_status);
@@ -2814,7 +2814,7 @@ fn divide() {
28142814
(m_smallest_normalized, m_smallest_normalized, "0x1p+0", Status::OK, Category::Normal),
28152815
];
28162816

2817-
for &(x, y, e_result, e_status, e_category) in &special_cases[..] {
2817+
for (x, y, e_result, e_status, e_category) in special_cases {
28182818
let status;
28192819
let result = unpack!(status=, x / y);
28202820
assert_eq!(status, e_status);

compiler/rustc_apfloat/tests/ppc.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ fn ppc_double_double_add_special() {
6464
(0x7ff8000000000000, 0x3ff0000000000000, Category::NaN, Round::NearestTiesToEven),
6565
];
6666

67-
for &(op1, op2, expected, round) in &data {
67+
for (op1, op2, expected, round) in data {
6868
{
6969
let mut a1 = DoubleDouble::from_bits(op1);
7070
let a2 = DoubleDouble::from_bits(op2);
@@ -135,7 +135,7 @@ fn ppc_double_double_add() {
135135
),
136136
];
137137

138-
for &(op1, op2, expected, round) in &data {
138+
for (op1, op2, expected, round) in data {
139139
{
140140
let mut a1 = DoubleDouble::from_bits(op1);
141141
let a2 = DoubleDouble::from_bits(op2);
@@ -172,7 +172,7 @@ fn ppc_double_double_subtract() {
172172
),
173173
];
174174

175-
for &(op1, op2, expected, round) in &data {
175+
for (op1, op2, expected, round) in data {
176176
let mut a1 = DoubleDouble::from_bits(op1);
177177
let a2 = DoubleDouble::from_bits(op2);
178178
a1 = a1.sub_r(a2, round).value;
@@ -204,7 +204,7 @@ fn ppc_double_double_multiply_special() {
204204
(0, 0x3ff0000000000000, Category::Zero, Round::NearestTiesToEven),
205205
];
206206

207-
for &(op1, op2, expected, round) in &data {
207+
for (op1, op2, expected, round) in data {
208208
{
209209
let mut a1 = DoubleDouble::from_bits(op1);
210210
let a2 = DoubleDouble::from_bits(op2);
@@ -290,7 +290,7 @@ fn ppc_double_double_multiply() {
290290
),
291291
];
292292

293-
for &(op1, op2, expected, round) in &data {
293+
for (op1, op2, expected, round) in data {
294294
{
295295
let mut a1 = DoubleDouble::from_bits(op1);
296296
let a2 = DoubleDouble::from_bits(op2);
@@ -322,7 +322,7 @@ fn ppc_double_double_divide() {
322322
),
323323
];
324324

325-
for &(op1, op2, expected, round) in &data {
325+
for (op1, op2, expected, round) in data {
326326
let mut a1 = DoubleDouble::from_bits(op1);
327327
let a2 = DoubleDouble::from_bits(op2);
328328
a1 = a1.div_r(a2, round).value;
@@ -348,7 +348,7 @@ fn ppc_double_double_remainder() {
348348
),
349349
];
350350

351-
for &(op1, op2, expected) in &data {
351+
for (op1, op2, expected) in data {
352352
let a1 = DoubleDouble::from_bits(op1);
353353
let a2 = DoubleDouble::from_bits(op2);
354354
let result = a1.ieee_rem(a2).value;
@@ -376,7 +376,7 @@ fn ppc_double_double_mod() {
376376
),
377377
];
378378

379-
for &(op1, op2, expected) in &data {
379+
for (op1, op2, expected) in data {
380380
let a1 = DoubleDouble::from_bits(op1);
381381
let a2 = DoubleDouble::from_bits(op2);
382382
let r = (a1 % a2).value;
@@ -426,7 +426,7 @@ fn ppc_double_double_compare() {
426426
(0x7ff0000000000000, 0x7ff0000000000000, Some(Ordering::Equal)),
427427
];
428428

429-
for &(op1, op2, expected) in &data {
429+
for (op1, op2, expected) in data {
430430
let a1 = DoubleDouble::from_bits(op1);
431431
let a2 = DoubleDouble::from_bits(op2);
432432
assert_eq!(expected, a1.partial_cmp(&a2), "compare({:#x}, {:#x})", op1, op2,);
@@ -448,7 +448,7 @@ fn ppc_double_double_bitwise_eq() {
448448
(0x7ff0000000000000, 0x7ff0000000000000, true),
449449
];
450450

451-
for &(op1, op2, expected) in &data {
451+
for (op1, op2, expected) in data {
452452
let a1 = DoubleDouble::from_bits(op1);
453453
let a2 = DoubleDouble::from_bits(op2);
454454
assert_eq!(expected, a1.bitwise_eq(a2), "{:#x} = {:#x}", op1, op2);

compiler/rustc_ast_lowering/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
417417
fn allocate_use_tree_hir_id_counters(&mut self, tree: &UseTree) {
418418
match tree.kind {
419419
UseTreeKind::Simple(_, id1, id2) => {
420-
for &id in &[id1, id2] {
420+
for id in [id1, id2] {
421421
self.lctx.allocate_hir_id_counter(id);
422422
}
423423
}

compiler/rustc_codegen_cranelift/src/compiler_builtins.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ macro builtin_functions($register:ident; $(fn $name:ident($($arg_name:ident: $ar
77

88
#[cfg(feature = "jit")]
99
pub(crate) fn $register(builder: &mut cranelift_jit::JITBuilder) {
10-
for &(name, val) in &[$((stringify!($name), $name as *const u8)),*] {
10+
for (name, val) in [$((stringify!($name), $name as *const u8)),*] {
1111
builder.symbol(name, val);
1212
}
1313
}

compiler/rustc_expand/src/parse/tests.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ fn span_of_self_arg_pat_idents_are_correct() {
193193
"impl z { fn a (self: Foo, &myarg: i32) {} }",
194194
];
195195

196-
for &src in &srcs {
196+
for src in srcs {
197197
let spans = get_spans_of_pat_idents(src);
198198
let (lo, hi) = (spans[0].lo(), spans[0].hi());
199199
assert!(

compiler/rustc_infer/src/infer/region_constraints/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ impl<'tcx> RegionConstraintCollector<'_, 'tcx> {
674674
self.combine_map(t).insert(vars, c);
675675
self.undo_log.push(AddCombination(t, vars));
676676
let new_r = tcx.mk_region(ReVar(c));
677-
for &old_r in &[a, b] {
677+
for old_r in [a, b] {
678678
match t {
679679
Glb => self.make_subregion(origin.clone(), new_r, old_r),
680680
Lub => self.make_subregion(origin.clone(), old_r, new_r),

compiler/rustc_passes/src/stability.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ pub fn check_unused_or_stable_features(tcx: TyCtxt<'_>) {
938938
if !remaining_lib_features.is_empty() {
939939
check_features(&mut remaining_lib_features, &local_defined_features);
940940

941-
for &cnum in &*tcx.crates() {
941+
for &cnum in tcx.crates() {
942942
if remaining_lib_features.is_empty() {
943943
break;
944944
}

compiler/rustc_serialize/tests/json.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ fn test_decode_str() {
437437
("\"\\uAB12\"", "\u{AB12}"),
438438
];
439439

440-
for &(i, o) in &s {
440+
for (i, o) in s {
441441
let v: string::String = json::decode(i).unwrap();
442442
assert_eq!(v, o);
443443
}

compiler/rustc_session/src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ fn default_configuration(sess: &Session) -> CrateConfig {
833833
if sess.target.has_elf_tls {
834834
ret.insert((sym::target_thread_local, None));
835835
}
836-
for &(i, align) in &[
836+
for (i, align) in [
837837
(8, layout.i8_align.abi),
838838
(16, layout.i16_align.abi),
839839
(32, layout.i32_align.abi),
@@ -1169,7 +1169,7 @@ pub fn get_cmd_lint_options(
11691169
let mut lint_opts_with_position = vec![];
11701170
let mut describe_lints = false;
11711171

1172-
for &level in &[lint::Allow, lint::Warn, lint::Deny, lint::Forbid] {
1172+
for level in [lint::Allow, lint::Warn, lint::Deny, lint::Forbid] {
11731173
for (passed_arg_pos, lint_name) in matches.opt_strs_pos(level.as_str()) {
11741174
let arg_pos = if let lint::Forbid = level {
11751175
// HACK: forbid is always specified last, so it can't be overridden.

compiler/rustc_target/src/abi/call/x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ where
185185
if let Ok(cls) = cls_or_mem {
186186
let mut needed_int = 0;
187187
let mut needed_sse = 0;
188-
for &c in &cls {
188+
for c in cls {
189189
match c {
190190
Some(Class::Int) => needed_int += 1,
191191
Some(Class::Sse) => needed_sse += 1,

0 commit comments

Comments
 (0)