Skip to content

Commit 396dda0

Browse files
committed
Rollup merge of rust-lang#53062 - ljedrz:redundant_field_names, r=Mark-Simulacrum
Remove redundant field names in structs
2 parents b643351 + d46dca6 commit 396dda0

File tree

11 files changed

+50
-50
lines changed

11 files changed

+50
-50
lines changed

src/libcore/cell.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ impl<'b, T: ?Sized> RefMut<'b, T> {
12581258
let RefMut { value, borrow } = orig;
12591259
RefMut {
12601260
value: f(value),
1261-
borrow: borrow,
1261+
borrow,
12621262
}
12631263
}
12641264

@@ -1324,7 +1324,7 @@ impl<'b> BorrowRefMut<'b> {
13241324
match borrow.get() {
13251325
UNUSED => {
13261326
borrow.set(UNUSED - 1);
1327-
Some(BorrowRefMut { borrow: borrow })
1327+
Some(BorrowRefMut { borrow })
13281328
},
13291329
_ => None,
13301330
}
@@ -1467,7 +1467,7 @@ impl<T> UnsafeCell<T> {
14671467
#[stable(feature = "rust1", since = "1.0.0")]
14681468
#[inline]
14691469
pub const fn new(value: T) -> UnsafeCell<T> {
1470-
UnsafeCell { value: value }
1470+
UnsafeCell { value }
14711471
}
14721472

14731473
/// Unwraps the value.

src/libcore/iter/iterator.rs

+9-9
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ pub trait Iterator {
507507
fn map<B, F>(self, f: F) -> Map<Self, F> where
508508
Self: Sized, F: FnMut(Self::Item) -> B,
509509
{
510-
Map{iter: self, f: f}
510+
Map { iter: self, f }
511511
}
512512

513513
/// Calls a closure on each element of an iterator.
@@ -618,7 +618,7 @@ pub trait Iterator {
618618
fn filter<P>(self, predicate: P) -> Filter<Self, P> where
619619
Self: Sized, P: FnMut(&Self::Item) -> bool,
620620
{
621-
Filter{iter: self, predicate: predicate}
621+
Filter {iter: self, predicate }
622622
}
623623

624624
/// Creates an iterator that both filters and maps.
@@ -675,7 +675,7 @@ pub trait Iterator {
675675
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F> where
676676
Self: Sized, F: FnMut(Self::Item) -> Option<B>,
677677
{
678-
FilterMap { iter: self, f: f }
678+
FilterMap { iter: self, f }
679679
}
680680

681681
/// Creates an iterator which gives the current iteration count as well as
@@ -828,7 +828,7 @@ pub trait Iterator {
828828
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P> where
829829
Self: Sized, P: FnMut(&Self::Item) -> bool,
830830
{
831-
SkipWhile{iter: self, flag: false, predicate: predicate}
831+
SkipWhile { iter: self, flag: false, predicate }
832832
}
833833

834834
/// Creates an iterator that yields elements based on a predicate.
@@ -908,7 +908,7 @@ pub trait Iterator {
908908
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P> where
909909
Self: Sized, P: FnMut(&Self::Item) -> bool,
910910
{
911-
TakeWhile{iter: self, flag: false, predicate: predicate}
911+
TakeWhile { iter: self, flag: false, predicate }
912912
}
913913

914914
/// Creates an iterator that skips the first `n` elements.
@@ -930,7 +930,7 @@ pub trait Iterator {
930930
#[inline]
931931
#[stable(feature = "rust1", since = "1.0.0")]
932932
fn skip(self, n: usize) -> Skip<Self> where Self: Sized {
933-
Skip{iter: self, n: n}
933+
Skip { iter: self, n }
934934
}
935935

936936
/// Creates an iterator that yields its first `n` elements.
@@ -962,7 +962,7 @@ pub trait Iterator {
962962
#[inline]
963963
#[stable(feature = "rust1", since = "1.0.0")]
964964
fn take(self, n: usize) -> Take<Self> where Self: Sized, {
965-
Take{iter: self, n: n}
965+
Take { iter: self, n }
966966
}
967967

968968
/// An iterator adaptor similar to [`fold`] that holds internal state and
@@ -1007,7 +1007,7 @@ pub trait Iterator {
10071007
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
10081008
where Self: Sized, F: FnMut(&mut St, Self::Item) -> Option<B>,
10091009
{
1010-
Scan{iter: self, f: f, state: initial_state}
1010+
Scan { iter: self, f, state: initial_state }
10111011
}
10121012

10131013
/// Creates an iterator that works like map, but flattens nested structure.
@@ -1256,7 +1256,7 @@ pub trait Iterator {
12561256
fn inspect<F>(self, f: F) -> Inspect<Self, F> where
12571257
Self: Sized, F: FnMut(&Self::Item),
12581258
{
1259-
Inspect{iter: self, f: f}
1259+
Inspect { iter: self, f }
12601260
}
12611261

12621262
/// Borrows an iterator, rather than consuming it.

src/libcore/num/dec2flt/parse.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ pub struct Decimal<'a> {
4040

4141
impl<'a> Decimal<'a> {
4242
pub fn new(integral: &'a [u8], fractional: &'a [u8], exp: i64) -> Decimal<'a> {
43-
Decimal { integral: integral, fractional: fractional, exp: exp }
43+
Decimal { integral, fractional, exp }
4444
}
4545
}
4646

src/libcore/num/dec2flt/rawfp.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub struct Unpacked {
4545

4646
impl Unpacked {
4747
pub fn new(sig: u64, k: i16) -> Self {
48-
Unpacked { sig: sig, k: k }
48+
Unpacked { sig, k }
4949
}
5050
}
5151

@@ -317,13 +317,13 @@ pub fn big_to_fp(f: &Big) -> Fp {
317317
// We cut off all bits prior to the index `start`, i.e., we effectively right-shift by
318318
// an amount of `start`, so this is also the exponent we need.
319319
let e = start as i16;
320-
let rounded_down = Fp { f: leading, e: e }.normalize();
320+
let rounded_down = Fp { f: leading, e }.normalize();
321321
// Round (half-to-even) depending on the truncated bits.
322322
match num::compare_with_half_ulp(f, start) {
323323
Less => rounded_down,
324324
Equal if leading % 2 == 0 => rounded_down,
325325
Equal | Greater => match leading.checked_add(1) {
326-
Some(f) => Fp { f: f, e: e }.normalize(),
326+
Some(f) => Fp { f, e }.normalize(),
327327
None => Fp { f: 1 << 63, e: e + 1 },
328328
}
329329
}

src/libcore/num/diy_float.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ impl Fp {
4242
let tmp = (bd >> 32) + (ad & MASK) + (bc & MASK) + (1 << 31) /* round */;
4343
let f = ac + (ad >> 32) + (bc >> 32) + (tmp >> 32);
4444
let e = self.e + other.e + 64;
45-
Fp { f: f, e: e }
45+
Fp { f, e }
4646
}
4747

4848
/// Normalizes itself so that the resulting mantissa is at least `2^63`.
@@ -74,7 +74,7 @@ impl Fp {
7474
e -= 1;
7575
}
7676
debug_assert!(f >= (1 >> 63));
77-
Fp { f: f, e: e }
77+
Fp { f, e }
7878
}
7979

8080
/// Normalizes itself to have the shared exponent.

src/libcore/num/flt2dec/decoder.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ pub fn decode<T: DecodableFloat>(v: T) -> (/*negative?*/ bool, FullDecoded) {
7777
// neighbors: (mant - 2, exp) -- (mant, exp) -- (mant + 2, exp)
7878
// Float::integer_decode always preserves the exponent,
7979
// so the mantissa is scaled for subnormals.
80-
FullDecoded::Finite(Decoded { mant: mant, minus: 1, plus: 1,
81-
exp: exp, inclusive: even })
80+
FullDecoded::Finite(Decoded { mant, minus: 1, plus: 1,
81+
exp, inclusive: even })
8282
}
8383
FpCategory::Normal => {
8484
let minnorm = <T as DecodableFloat>::min_pos_norm_value().integer_decode();

src/libcore/num/flt2dec/mod.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -424,20 +424,20 @@ pub fn to_shortest_str<'a, T, F>(mut format_shortest: F, v: T,
424424
match full_decoded {
425425
FullDecoded::Nan => {
426426
parts[0] = Part::Copy(b"NaN");
427-
Formatted { sign: sign, parts: &parts[..1] }
427+
Formatted { sign, parts: &parts[..1] }
428428
}
429429
FullDecoded::Infinite => {
430430
parts[0] = Part::Copy(b"inf");
431-
Formatted { sign: sign, parts: &parts[..1] }
431+
Formatted { sign, parts: &parts[..1] }
432432
}
433433
FullDecoded::Zero => {
434434
if frac_digits > 0 { // [0.][0000]
435435
parts[0] = Part::Copy(b"0.");
436436
parts[1] = Part::Zero(frac_digits);
437-
Formatted { sign: sign, parts: &parts[..2] }
437+
Formatted { sign, parts: &parts[..2] }
438438
} else {
439439
parts[0] = Part::Copy(b"0");
440-
Formatted { sign: sign, parts: &parts[..1] }
440+
Formatted { sign, parts: &parts[..1] }
441441
}
442442
}
443443
FullDecoded::Finite(ref decoded) => {
@@ -480,19 +480,19 @@ pub fn to_shortest_exp_str<'a, T, F>(mut format_shortest: F, v: T,
480480
match full_decoded {
481481
FullDecoded::Nan => {
482482
parts[0] = Part::Copy(b"NaN");
483-
Formatted { sign: sign, parts: &parts[..1] }
483+
Formatted { sign, parts: &parts[..1] }
484484
}
485485
FullDecoded::Infinite => {
486486
parts[0] = Part::Copy(b"inf");
487-
Formatted { sign: sign, parts: &parts[..1] }
487+
Formatted { sign, parts: &parts[..1] }
488488
}
489489
FullDecoded::Zero => {
490490
parts[0] = if dec_bounds.0 <= 0 && 0 < dec_bounds.1 {
491491
Part::Copy(b"0")
492492
} else {
493493
Part::Copy(if upper { b"0E0" } else { b"0e0" })
494494
};
495-
Formatted { sign: sign, parts: &parts[..1] }
495+
Formatted { sign, parts: &parts[..1] }
496496
}
497497
FullDecoded::Finite(ref decoded) => {
498498
let (len, exp) = format_shortest(decoded, buf);
@@ -502,7 +502,7 @@ pub fn to_shortest_exp_str<'a, T, F>(mut format_shortest: F, v: T,
502502
} else {
503503
digits_to_exp_str(&buf[..len], exp, 0, upper, parts)
504504
};
505-
Formatted { sign: sign, parts: parts }
505+
Formatted { sign, parts }
506506
}
507507
}
508508
}
@@ -558,21 +558,21 @@ pub fn to_exact_exp_str<'a, T, F>(mut format_exact: F, v: T,
558558
match full_decoded {
559559
FullDecoded::Nan => {
560560
parts[0] = Part::Copy(b"NaN");
561-
Formatted { sign: sign, parts: &parts[..1] }
561+
Formatted { sign, parts: &parts[..1] }
562562
}
563563
FullDecoded::Infinite => {
564564
parts[0] = Part::Copy(b"inf");
565-
Formatted { sign: sign, parts: &parts[..1] }
565+
Formatted { sign, parts: &parts[..1] }
566566
}
567567
FullDecoded::Zero => {
568568
if ndigits > 1 { // [0.][0000][e0]
569569
parts[0] = Part::Copy(b"0.");
570570
parts[1] = Part::Zero(ndigits - 1);
571571
parts[2] = Part::Copy(if upper { b"E0" } else { b"e0" });
572-
Formatted { sign: sign, parts: &parts[..3] }
572+
Formatted { sign, parts: &parts[..3] }
573573
} else {
574574
parts[0] = Part::Copy(if upper { b"0E0" } else { b"0e0" });
575-
Formatted { sign: sign, parts: &parts[..1] }
575+
Formatted { sign, parts: &parts[..1] }
576576
}
577577
}
578578
FullDecoded::Finite(ref decoded) => {
@@ -613,20 +613,20 @@ pub fn to_exact_fixed_str<'a, T, F>(mut format_exact: F, v: T,
613613
match full_decoded {
614614
FullDecoded::Nan => {
615615
parts[0] = Part::Copy(b"NaN");
616-
Formatted { sign: sign, parts: &parts[..1] }
616+
Formatted { sign, parts: &parts[..1] }
617617
}
618618
FullDecoded::Infinite => {
619619
parts[0] = Part::Copy(b"inf");
620-
Formatted { sign: sign, parts: &parts[..1] }
620+
Formatted { sign, parts: &parts[..1] }
621621
}
622622
FullDecoded::Zero => {
623623
if frac_digits > 0 { // [0.][0000]
624624
parts[0] = Part::Copy(b"0.");
625625
parts[1] = Part::Zero(frac_digits);
626-
Formatted { sign: sign, parts: &parts[..2] }
626+
Formatted { sign, parts: &parts[..2] }
627627
} else {
628628
parts[0] = Part::Copy(b"0");
629-
Formatted { sign: sign, parts: &parts[..1] }
629+
Formatted { sign, parts: &parts[..1] }
630630
}
631631
}
632632
FullDecoded::Finite(ref decoded) => {
@@ -646,10 +646,10 @@ pub fn to_exact_fixed_str<'a, T, F>(mut format_exact: F, v: T,
646646
if frac_digits > 0 { // [0.][0000]
647647
parts[0] = Part::Copy(b"0.");
648648
parts[1] = Part::Zero(frac_digits);
649-
Formatted { sign: sign, parts: &parts[..2] }
649+
Formatted { sign, parts: &parts[..2] }
650650
} else {
651651
parts[0] = Part::Copy(b"0");
652-
Formatted { sign: sign, parts: &parts[..1] }
652+
Formatted { sign, parts: &parts[..1] }
653653
}
654654
} else {
655655
Formatted { sign,

src/libcore/num/flt2dec/strategy/grisu.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ pub fn cached_power(alpha: i16, gamma: i16) -> (i16, Fp) {
129129
let idx = ((gamma as i32) - offset) * range / domain;
130130
let (f, e, k) = CACHED_POW10[idx as usize];
131131
debug_assert!(alpha <= e && e <= gamma);
132-
(k, Fp { f: f, e: e })
132+
(k, Fp { f, e })
133133
}
134134

135135
/// Given `x > 0`, returns `(k, 10^k)` such that `10^k <= x < 10^(k+1)`.

src/libcore/slice/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,7 @@ impl<T> [T] {
621621
#[inline]
622622
pub fn windows(&self, size: usize) -> Windows<T> {
623623
assert!(size != 0);
624-
Windows { v: self, size: size }
624+
Windows { v: self, size }
625625
}
626626

627627
/// Returns an iterator over `chunk_size` elements of the slice at a
@@ -652,7 +652,7 @@ impl<T> [T] {
652652
#[inline]
653653
pub fn chunks(&self, chunk_size: usize) -> Chunks<T> {
654654
assert!(chunk_size != 0);
655-
Chunks { v: self, chunk_size: chunk_size }
655+
Chunks { v: self, chunk_size }
656656
}
657657

658658
/// Returns an iterator over `chunk_size` elements of the slice at a time.
@@ -687,7 +687,7 @@ impl<T> [T] {
687687
#[inline]
688688
pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<T> {
689689
assert!(chunk_size != 0);
690-
ChunksMut { v: self, chunk_size: chunk_size }
690+
ChunksMut { v: self, chunk_size }
691691
}
692692

693693
/// Returns an iterator over `chunk_size` elements of the slice at a
@@ -724,7 +724,7 @@ impl<T> [T] {
724724
let rem = self.len() % chunk_size;
725725
let len = self.len() - rem;
726726
let (fst, snd) = self.split_at(len);
727-
ExactChunks { v: fst, rem: snd, chunk_size: chunk_size}
727+
ExactChunks { v: fst, rem: snd, chunk_size }
728728
}
729729

730730
/// Returns an iterator over `chunk_size` elements of the slice at a time.
@@ -766,7 +766,7 @@ impl<T> [T] {
766766
let rem = self.len() % chunk_size;
767767
let len = self.len() - rem;
768768
let (fst, snd) = self.split_at_mut(len);
769-
ExactChunksMut { v: fst, rem: snd, chunk_size: chunk_size}
769+
ExactChunksMut { v: fst, rem: snd, chunk_size }
770770
}
771771

772772
/// Divides one slice into two at an index.
@@ -916,7 +916,7 @@ impl<T> [T] {
916916
pub fn split_mut<F>(&mut self, pred: F) -> SplitMut<T, F>
917917
where F: FnMut(&T) -> bool
918918
{
919-
SplitMut { v: self, pred: pred, finished: false }
919+
SplitMut { v: self, pred, finished: false }
920920
}
921921

922922
/// Returns an iterator over subslices separated by elements that match

src/libcore/task/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ impl<'a> Context<'a> {
8686
{
8787
Context {
8888
local_waker: self.local_waker,
89-
executor: executor,
89+
executor,
9090
}
9191
}
9292
}

src/libcore/time.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl Duration {
9191
let secs = secs.checked_add((nanos / NANOS_PER_SEC) as u64)
9292
.expect("overflow in Duration::new");
9393
let nanos = nanos % NANOS_PER_SEC;
94-
Duration { secs: secs, nanos: nanos }
94+
Duration { secs, nanos }
9595
}
9696

9797
/// Creates a new `Duration` from the specified number of whole seconds.
@@ -109,7 +109,7 @@ impl Duration {
109109
#[stable(feature = "duration", since = "1.3.0")]
110110
#[inline]
111111
pub const fn from_secs(secs: u64) -> Duration {
112-
Duration { secs: secs, nanos: 0 }
112+
Duration { secs, nanos: 0 }
113113
}
114114

115115
/// Creates a new `Duration` from the specified number of milliseconds.
@@ -387,7 +387,7 @@ impl Duration {
387387
}
388388
};
389389
debug_assert!(nanos < NANOS_PER_SEC);
390-
Some(Duration { secs: secs, nanos: nanos })
390+
Some(Duration { secs, nanos })
391391
} else {
392392
None
393393
}
@@ -453,7 +453,7 @@ impl Duration {
453453
let extra_nanos = carry * (NANOS_PER_SEC as u64) / (rhs as u64);
454454
let nanos = self.nanos / rhs + (extra_nanos as u32);
455455
debug_assert!(nanos < NANOS_PER_SEC);
456-
Some(Duration { secs: secs, nanos: nanos })
456+
Some(Duration { secs, nanos })
457457
} else {
458458
None
459459
}

0 commit comments

Comments
 (0)