about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2017-08-16 04:00:24 +0000
committerbors <bors@rust-lang.org>2017-08-16 04:00:24 +0000
commit6f4ab9458a7ad06c8ce630604f533c8c0c0acef4 (patch)
tree8b1076cf97b6482b624b3655e078a4530a460cb3 /src/libstd
parente40dc66f47614eb2d1c8026d112a27b6f8b291d0 (diff)
parent1b6c9605e41b7c7dc23e0e6f633f05912d0463dd (diff)
downloadrust-6f4ab9458a7ad06c8ce630604f533c8c0c0acef4.tar.gz
rust-6f4ab9458a7ad06c8ce630604f533c8c0c0acef4.zip
Auto merge of #43710 - zackmdavis:field_init_shorthand_power_slam, r=Mark-Simulacrum
use field init shorthand EVERYWHERE

Like #43008 (f668999), but [(lacking reasons to be more timid)](https://github.com/rust-lang/rust/pull/43008#issuecomment-312463564) _much more aggressive_.

r? @Mark-Simulacrum
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/collections/hash/map.rs18
-rw-r--r--src/libstd/collections/hash/set.rs4
-rw-r--r--src/libstd/collections/hash/table.rs14
-rw-r--r--src/libstd/io/buffered.rs2
-rw-r--r--src/libstd/io/error.rs4
-rw-r--r--src/libstd/io/lazy.rs2
-rw-r--r--src/libstd/panicking.rs2
-rw-r--r--src/libstd/path.rs2
-rw-r--r--src/libstd/process.rs8
-rw-r--r--src/libstd/sync/mpsc/blocking.rs2
-rw-r--r--src/libstd/sync/mpsc/select.rs4
-rw-r--r--src/libstd/sync/mpsc/sync.rs2
-rw-r--r--src/libstd/sys/redox/net/dns/mod.rs8
-rw-r--r--src/libstd/sys/unix/backtrace/tracing/gcc_s.rs2
-rw-r--r--src/libstd/sys/unix/ext/net.rs4
-rw-r--r--src/libstd/sys/unix/process/magenta.rs2
-rw-r--r--src/libstd/sys/unix/process/process_common.rs4
-rw-r--r--src/libstd/sys/unix/weak.rs2
-rw-r--r--src/libstd/sys/windows/backtrace/mod.rs4
-rw-r--r--src/libstd/sys/windows/pipe.rs8
-rw-r--r--src/libstd/sys/windows/thread_local.rs4
-rw-r--r--src/libstd/sys_common/thread_info.rs4
-rw-r--r--src/libstd/sys_common/thread_local.rs2
-rw-r--r--src/libstd/thread/local.rs4
-rw-r--r--src/libstd/time/duration.rs8
25 files changed, 60 insertions, 60 deletions
diff --git a/src/libstd/collections/hash/map.rs b/src/libstd/collections/hash/map.rs
index 7e2229a8f84..16b0c709986 100644
--- a/src/libstd/collections/hash/map.rs
+++ b/src/libstd/collections/hash/map.rs
@@ -419,7 +419,7 @@ fn search_hashed<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F) -> Inter
             Empty(bucket) => {
                 // Found a hole!
                 return InternalEntry::Vacant {
-                    hash: hash,
+                    hash,
                     elem: NoElem(bucket, displacement),
                 };
             }
@@ -433,7 +433,7 @@ fn search_hashed<K, V, M, F>(table: M, hash: SafeHash, mut is_match: F) -> Inter
             // We can finish the search early if we hit any bucket
             // with a lower distance to initial bucket than we've probed.
             return InternalEntry::Vacant {
-                hash: hash,
+                hash,
                 elem: NeqElem(full, probe_displacement),
             };
         }
@@ -646,7 +646,7 @@ impl<K, V, S> HashMap<K, V, S>
     #[stable(feature = "hashmap_build_hasher", since = "1.7.0")]
     pub fn with_hasher(hash_builder: S) -> HashMap<K, V, S> {
         HashMap {
-            hash_builder: hash_builder,
+            hash_builder,
             resize_policy: DefaultResizePolicy::new(),
             table: RawTable::new(0),
         }
@@ -679,8 +679,8 @@ impl<K, V, S> HashMap<K, V, S>
         let resize_policy = DefaultResizePolicy::new();
         let raw_cap = resize_policy.raw_capacity(capacity);
         HashMap {
-            hash_builder: hash_builder,
-            resize_policy: resize_policy,
+            hash_builder,
+            resize_policy,
             table: RawTable::new(raw_cap),
         }
     }
@@ -1496,14 +1496,14 @@ impl<'a, K, V> InternalEntry<K, V, &'a mut RawTable<K, V>> {
             InternalEntry::Occupied { elem } => {
                 Some(Occupied(OccupiedEntry {
                     key: Some(key),
-                    elem: elem,
+                    elem,
                 }))
             }
             InternalEntry::Vacant { hash, elem } => {
                 Some(Vacant(VacantEntry {
-                    hash: hash,
-                    key: key,
-                    elem: elem,
+                    hash,
+                    key,
+                    elem,
                 }))
             }
             InternalEntry::TableIsEmpty => None,
diff --git a/src/libstd/collections/hash/set.rs b/src/libstd/collections/hash/set.rs
index 80a223c7d74..9771363d545 100644
--- a/src/libstd/collections/hash/set.rs
+++ b/src/libstd/collections/hash/set.rs
@@ -337,7 +337,7 @@ impl<T, S> HashSet<T, S>
     pub fn difference<'a>(&'a self, other: &'a HashSet<T, S>) -> Difference<'a, T, S> {
         Difference {
             iter: self.iter(),
-            other: other,
+            other,
         }
     }
 
@@ -391,7 +391,7 @@ impl<T, S> HashSet<T, S>
     pub fn intersection<'a>(&'a self, other: &'a HashSet<T, S>) -> Intersection<'a, T, S> {
         Intersection {
             iter: self.iter(),
-            other: other,
+            other,
         }
     }
 
diff --git a/src/libstd/collections/hash/table.rs b/src/libstd/collections/hash/table.rs
index 6f7c5a5de42..f1e8ff66af1 100644
--- a/src/libstd/collections/hash/table.rs
+++ b/src/libstd/collections/hash/table.rs
@@ -353,14 +353,14 @@ impl<K, V, M: Deref<Target = RawTable<K, V>>> Bucket<K, V, M> {
         let ib_index = ib_index & table.capacity_mask;
         Bucket {
             raw: table.raw_bucket_at(ib_index),
-            table: table,
+            table,
         }
     }
 
     pub fn first(table: M) -> Bucket<K, V, M> {
         Bucket {
             raw: table.raw_bucket_at(0),
-            table: table,
+            table,
         }
     }
 
@@ -455,7 +455,7 @@ impl<K, V, M: Deref<Target = RawTable<K, V>>> EmptyBucket<K, V, M> {
         match self.next().peek() {
             Full(bucket) => {
                 Ok(GapThenFull {
-                    gap: gap,
+                    gap,
                     full: bucket,
                 })
             }
@@ -860,8 +860,8 @@ impl<K, V> RawTable<K, V> {
         // Replace the marker regardless of lifetime bounds on parameters.
         IntoIter {
             iter: RawBuckets {
-                raw: raw,
-                elems_left: elems_left,
+                raw,
+                elems_left,
                 marker: marker::PhantomData,
             },
             table: self,
@@ -873,8 +873,8 @@ impl<K, V> RawTable<K, V> {
         // Replace the marker regardless of lifetime bounds on parameters.
         Drain {
             iter: RawBuckets {
-                raw: raw,
-                elems_left: elems_left,
+                raw,
+                elems_left,
                 marker: marker::PhantomData,
             },
             table: Shared::from(self),
diff --git a/src/libstd/io/buffered.rs b/src/libstd/io/buffered.rs
index d765dd227be..4ebd3554fd1 100644
--- a/src/libstd/io/buffered.rs
+++ b/src/libstd/io/buffered.rs
@@ -97,7 +97,7 @@ impl<R: Read> BufReader<R> {
             buffer.set_len(cap);
             inner.initializer().initialize(&mut buffer);
             BufReader {
-                inner: inner,
+                inner,
                 buf: buffer.into_boxed_slice(),
                 pos: 0,
                 cap: 0,
diff --git a/src/libstd/io/error.rs b/src/libstd/io/error.rs
index 68f55221a6c..bb9383d3d6e 100644
--- a/src/libstd/io/error.rs
+++ b/src/libstd/io/error.rs
@@ -252,8 +252,8 @@ impl Error {
     fn _new(kind: ErrorKind, error: Box<error::Error+Send+Sync>) -> Error {
         Error {
             repr: Repr::Custom(Box::new(Custom {
-                kind: kind,
-                error: error,
+                kind,
+                error,
             }))
         }
     }
diff --git a/src/libstd/io/lazy.rs b/src/libstd/io/lazy.rs
index ce205c3b11c..9cef4e3cdf1 100644
--- a/src/libstd/io/lazy.rs
+++ b/src/libstd/io/lazy.rs
@@ -27,7 +27,7 @@ impl<T: Send + Sync + 'static> Lazy<T> {
         Lazy {
             lock: Mutex::new(),
             ptr: Cell::new(ptr::null_mut()),
-            init: init
+            init,
         }
     }
 
diff --git a/src/libstd/panicking.rs b/src/libstd/panicking.rs
index 99567bd08bb..739dc4163fe 100644
--- a/src/libstd/panicking.rs
+++ b/src/libstd/panicking.rs
@@ -453,7 +453,7 @@ pub unsafe fn try<R, F: FnOnce() -> R>(f: F) -> Result<R, Box<Any + Send>> {
     let mut any_data = 0;
     let mut any_vtable = 0;
     let mut data = Data {
-        f: f,
+        f,
     };
 
     let r = __rust_maybe_catch_panic(do_call::<F, R>,
diff --git a/src/libstd/path.rs b/src/libstd/path.rs
index c90a0c78527..4496de09b25 100644
--- a/src/libstd/path.rs
+++ b/src/libstd/path.rs
@@ -2049,7 +2049,7 @@ impl Path {
         let prefix = parse_prefix(self.as_os_str());
         Components {
             path: self.as_u8_slice(),
-            prefix: prefix,
+            prefix,
             has_physical_root: has_physical_root(self.as_u8_slice(), prefix),
             front: State::Prefix,
             back: State::Body,
diff --git a/src/libstd/process.rs b/src/libstd/process.rs
index a872e7eee06..a3a7e91dd80 100644
--- a/src/libstd/process.rs
+++ b/src/libstd/process.rs
@@ -126,7 +126,7 @@ impl AsInner<imp::Process> for Child {
 impl FromInner<(imp::Process, imp::StdioPipes)> for Child {
     fn from_inner((handle, io): (imp::Process, imp::StdioPipes)) -> Child {
         Child {
-            handle: handle,
+            handle,
             stdin: io.stdin.map(ChildStdin::from_inner),
             stdout: io.stdout.map(ChildStdout::from_inner),
             stderr: io.stderr.map(ChildStderr::from_inner),
@@ -1035,9 +1035,9 @@ impl Child {
 
         let status = self.wait()?;
         Ok(Output {
-            status: status,
-            stdout: stdout,
-            stderr: stderr,
+            status,
+            stdout,
+            stderr,
         })
     }
 }
diff --git a/src/libstd/sync/mpsc/blocking.rs b/src/libstd/sync/mpsc/blocking.rs
index 0f9ef6fabb0..c08bd6d133d 100644
--- a/src/libstd/sync/mpsc/blocking.rs
+++ b/src/libstd/sync/mpsc/blocking.rs
@@ -46,7 +46,7 @@ pub fn tokens() -> (WaitToken, SignalToken) {
         inner: inner.clone(),
     };
     let signal_token = SignalToken {
-        inner: inner
+        inner,
     };
     (wait_token, signal_token)
 }
diff --git a/src/libstd/sync/mpsc/select.rs b/src/libstd/sync/mpsc/select.rs
index 8b4da532af6..e49f4cff024 100644
--- a/src/libstd/sync/mpsc/select.rs
+++ b/src/libstd/sync/mpsc/select.rs
@@ -148,12 +148,12 @@ impl Select {
         let id = self.next_id.get();
         self.next_id.set(id + 1);
         Handle {
-            id: id,
+            id,
             selector: self.inner.get(),
             next: ptr::null_mut(),
             prev: ptr::null_mut(),
             added: false,
-            rx: rx,
+            rx,
             packet: rx,
         }
     }
diff --git a/src/libstd/sync/mpsc/sync.rs b/src/libstd/sync/mpsc/sync.rs
index 1d16e002a2b..90f12c826d6 100644
--- a/src/libstd/sync/mpsc/sync.rs
+++ b/src/libstd/sync/mpsc/sync.rs
@@ -177,7 +177,7 @@ impl<T> Packet<T> {
             lock: Mutex::new(State {
                 disconnected: false,
                 blocker: NoneBlocked,
-                cap: cap,
+                cap,
                 canceled: None,
                 queue: Queue {
                     head: ptr::null_mut(),
diff --git a/src/libstd/sys/redox/net/dns/mod.rs b/src/libstd/sys/redox/net/dns/mod.rs
index 49cde89dc05..1a26257e4a7 100644
--- a/src/libstd/sys/redox/net/dns/mod.rs
+++ b/src/libstd/sys/redox/net/dns/mod.rs
@@ -206,10 +206,10 @@ impl Dns {
         }
 
         Ok(Dns {
-            transaction_id: transaction_id,
-            flags: flags,
-            queries: queries,
-            answers: answers,
+            transaction_id,
+            flags,
+            queries,
+            answers,
         })
     }
 }
diff --git a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs
index cfeabaddda9..e3ffbe88acd 100644
--- a/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs
+++ b/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs
@@ -43,7 +43,7 @@ pub fn unwind_backtrace(frames: &mut [Frame])
 {
     let mut cx = Context {
         idx: 0,
-        frames: frames,
+        frames,
     };
     let result_unwind = unsafe {
         uw::_Unwind_Backtrace(trace_fn,
diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs
index 27853427128..f454f1fc479 100644
--- a/src/libstd/sys/unix/ext/net.rs
+++ b/src/libstd/sys/unix/ext/net.rs
@@ -141,8 +141,8 @@ impl SocketAddr {
         }
 
         Ok(SocketAddr {
-            addr: addr,
-            len: len,
+            addr,
+            len,
         })
     }
 
diff --git a/src/libstd/sys/unix/process/magenta.rs b/src/libstd/sys/unix/process/magenta.rs
index ab609126cdb..bc20a74f114 100644
--- a/src/libstd/sys/unix/process/magenta.rs
+++ b/src/libstd/sys/unix/process/magenta.rs
@@ -61,7 +61,7 @@ pub struct Handle {
 impl Handle {
     pub fn new(raw: mx_handle_t) -> Handle {
         Handle {
-            raw: raw,
+            raw,
         }
     }
 
diff --git a/src/libstd/sys/unix/process/process_common.rs b/src/libstd/sys/unix/process/process_common.rs
index 839e2d88d6a..689ccd78524 100644
--- a/src/libstd/sys/unix/process/process_common.rs
+++ b/src/libstd/sys/unix/process/process_common.rs
@@ -94,14 +94,14 @@ impl Command {
         let program = os2c(program, &mut saw_nul);
         Command {
             argv: vec![program.as_ptr(), ptr::null()],
-            program: program,
+            program,
             args: Vec::new(),
             env: None,
             envp: None,
             cwd: None,
             uid: None,
             gid: None,
-            saw_nul: saw_nul,
+            saw_nul,
             closures: Vec::new(),
             stdin: None,
             stdout: None,
diff --git a/src/libstd/sys/unix/weak.rs b/src/libstd/sys/unix/weak.rs
index 99ab8741159..18944be58ee 100644
--- a/src/libstd/sys/unix/weak.rs
+++ b/src/libstd/sys/unix/weak.rs
@@ -49,7 +49,7 @@ pub struct Weak<F> {
 impl<F> Weak<F> {
     pub const fn new(name: &'static str) -> Weak<F> {
         Weak {
-            name: name,
+            name,
             addr: AtomicUsize::new(1),
             _marker: marker::PhantomData,
         }
diff --git a/src/libstd/sys/windows/backtrace/mod.rs b/src/libstd/sys/windows/backtrace/mod.rs
index 3c3fd8d3e4a..26b4cb90e0a 100644
--- a/src/libstd/sys/windows/backtrace/mod.rs
+++ b/src/libstd/sys/windows/backtrace/mod.rs
@@ -68,8 +68,8 @@ pub fn unwind_backtrace(frames: &mut [Frame])
 
     let backtrace_context = BacktraceContext {
         handle: process,
-        SymCleanup: SymCleanup,
-        dbghelp: dbghelp,
+        SymCleanup,
+        dbghelp,
     };
 
     // Initialize this process's symbols
diff --git a/src/libstd/sys/windows/pipe.rs b/src/libstd/sys/windows/pipe.rs
index be7482c4bb1..452d720ce59 100644
--- a/src/libstd/sys/windows/pipe.rs
+++ b/src/libstd/sys/windows/pipe.rs
@@ -239,10 +239,10 @@ impl<'a> AsyncPipe<'a> {
         };
         overlapped.hEvent = event.raw();
         Ok(AsyncPipe {
-            pipe: pipe,
-            overlapped: overlapped,
-            event: event,
-            dst: dst,
+            pipe,
+            overlapped,
+            event,
+            dst,
             state: State::NotReading,
         })
     }
diff --git a/src/libstd/sys/windows/thread_local.rs b/src/libstd/sys/windows/thread_local.rs
index ad57f87dc1f..7ae9ed917bd 100644
--- a/src/libstd/sys/windows/thread_local.rs
+++ b/src/libstd/sys/windows/thread_local.rs
@@ -122,8 +122,8 @@ struct Node {
 
 unsafe fn register_dtor(key: Key, dtor: Dtor) {
     let mut node = Box::new(Node {
-        key: key,
-        dtor: dtor,
+        key,
+        dtor,
         next: ptr::null_mut(),
     });
 
diff --git a/src/libstd/sys_common/thread_info.rs b/src/libstd/sys_common/thread_info.rs
index 2abb8afa828..7970042b1d6 100644
--- a/src/libstd/sys_common/thread_info.rs
+++ b/src/libstd/sys_common/thread_info.rs
@@ -45,7 +45,7 @@ pub fn stack_guard() -> Option<usize> {
 pub fn set(stack_guard: Option<usize>, thread: Thread) {
     THREAD_INFO.with(|c| assert!(c.borrow().is_none()));
     THREAD_INFO.with(move |c| *c.borrow_mut() = Some(ThreadInfo{
-        stack_guard: stack_guard,
-        thread: thread,
+        stack_guard,
+        thread,
     }));
 }
diff --git a/src/libstd/sys_common/thread_local.rs b/src/libstd/sys_common/thread_local.rs
index 1f889c70707..87ffd304e1a 100644
--- a/src/libstd/sys_common/thread_local.rs
+++ b/src/libstd/sys_common/thread_local.rs
@@ -128,7 +128,7 @@ impl StaticKey {
     pub const fn new(dtor: Option<unsafe extern fn(*mut u8)>) -> StaticKey {
         StaticKey {
             key: atomic::AtomicUsize::new(0),
-            dtor: dtor
+            dtor,
         }
     }
 
diff --git a/src/libstd/thread/local.rs b/src/libstd/thread/local.rs
index 48f611a3439..7a9b642350f 100644
--- a/src/libstd/thread/local.rs
+++ b/src/libstd/thread/local.rs
@@ -258,8 +258,8 @@ impl<T: 'static> LocalKey<T> {
     pub const unsafe fn new(inner: unsafe fn() -> Option<&'static UnsafeCell<Option<T>>>,
                             init: fn() -> T) -> LocalKey<T> {
         LocalKey {
-            inner: inner,
-            init: init,
+            inner,
+            init,
         }
     }
 
diff --git a/src/libstd/time/duration.rs b/src/libstd/time/duration.rs
index 48819adb23e..d715a0d740b 100644
--- a/src/libstd/time/duration.rs
+++ b/src/libstd/time/duration.rs
@@ -197,8 +197,8 @@ impl Duration {
             }
             debug_assert!(nanos < NANOS_PER_SEC);
             Some(Duration {
-                secs: secs,
-                nanos: nanos,
+                secs,
+                nanos,
             })
         } else {
             None
@@ -268,8 +268,8 @@ impl Duration {
             .and_then(|s| s.checked_add(extra_secs)) {
             debug_assert!(nanos < NANOS_PER_SEC);
             Some(Duration {
-                secs: secs,
-                nanos: nanos,
+                secs,
+                nanos,
             })
         } else {
             None