diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs index 91dddc7b5bc..cf6ebb48b2c 100644 --- a/src/bootstrap/builder.rs +++ b/src/bootstrap/builder.rs @@ -193,7 +193,7 @@ pub struct ShouldRun<'a> { impl<'a> ShouldRun<'a> { fn new(builder: &'a Builder) -> ShouldRun<'a> { ShouldRun { - builder: builder, + builder, paths: BTreeSet::new(), is_really_default: true, // by default no additional conditions } @@ -278,9 +278,9 @@ impl<'a> Builder<'a> { }; let builder = Builder { - build: build, + build, top_stage: build.config.stage.unwrap_or(2), - kind: kind, + kind, cache: Cache::new(), stack: RefCell::new(Vec::new()), }; @@ -309,9 +309,9 @@ impl<'a> Builder<'a> { }; let builder = Builder { - build: build, + build, top_stage: build.config.stage.unwrap_or(2), - kind: kind, + kind, cache: Cache::new(), stack: RefCell::new(Vec::new()), }; diff --git a/src/bootstrap/check.rs b/src/bootstrap/check.rs index 1823dd4ebc0..92fb2105b7c 100644 --- a/src/bootstrap/check.rs +++ b/src/bootstrap/check.rs @@ -872,7 +872,7 @@ impl Step for CrateLibrustc { builder.ensure(CrateLibrustc { compiler, target: run.target, - test_kind: test_kind, + test_kind, krate: name, }); }; @@ -934,8 +934,8 @@ impl Step for Crate { builder.ensure(Crate { compiler, target: run.target, - mode: mode, - test_kind: test_kind, + mode, + test_kind, krate: name, }); }; diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs index 33c3638a894..78bc225447b 100644 --- a/src/bootstrap/compile.rs +++ b/src/bootstrap/compile.rs @@ -74,13 +74,13 @@ impl Step for Std { let from = builder.compiler(1, build.build); builder.ensure(Std { compiler: from, - target: target, + target, }); println!("Uplifting stage1 std ({} -> {})", from.host, target); builder.ensure(StdLink { compiler: from, target_compiler: compiler, - target: target, + target, }); return; } @@ -100,7 +100,7 @@ impl Step for Std { builder.ensure(StdLink { compiler: builder.compiler(compiler.stage, build.build), target_compiler: compiler, - target: target, + target, }); } } @@ -202,7 +202,7 @@ impl Step for StdLink { builder.ensure(tool::CleanTools { compiler: target_compiler, - target: target, + target, mode: Mode::Libstd, }); } @@ -326,13 +326,13 @@ impl Step for Test { if build.force_use_stage1(compiler, target) { builder.ensure(Test { compiler: builder.compiler(1, build.build), - target: target, + target, }); println!("Uplifting stage1 test ({} -> {})", &build.build, target); builder.ensure(TestLink { compiler: builder.compiler(1, build.build), target_compiler: compiler, - target: target, + target, }); return; } @@ -351,7 +351,7 @@ impl Step for Test { builder.ensure(TestLink { compiler: builder.compiler(compiler.stage, build.build), target_compiler: compiler, - target: target, + target, }); } } @@ -398,7 +398,7 @@ impl Step for TestLink { &libtest_stamp(build, compiler, target)); builder.ensure(tool::CleanTools { compiler: target_compiler, - target: target, + target, mode: Mode::Libtest, }); } @@ -445,7 +445,7 @@ impl Step for Rustc { if build.force_use_stage1(compiler, target) { builder.ensure(Rustc { compiler: builder.compiler(1, build.build), - target: target, + target, }); println!("Uplifting stage1 rustc ({} -> {})", &build.build, target); builder.ensure(RustcLink { @@ -581,7 +581,7 @@ impl Step for RustcLink { &librustc_stamp(build, compiler, target)); builder.ensure(tool::CleanTools { compiler: target_compiler, - target: target, + target, mode: Mode::Librustc, }); } diff --git a/src/bootstrap/doc.rs b/src/bootstrap/doc.rs index 05c7d689f2c..5ade2c279e2 100644 --- a/src/bootstrap/doc.rs +++ b/src/bootstrap/doc.rs @@ -213,13 +213,13 @@ impl Step for TheBook { let name = self.name; // build book first edition builder.ensure(Rustbook { - target: target, + target, name: INTERNER.intern_string(format!("{}/first-edition", name)), }); // build book second edition builder.ensure(Rustbook { - target: target, + target, name: INTERNER.intern_string(format!("{}/second-edition", name)), }); diff --git a/src/bootstrap/flags.rs b/src/bootstrap/flags.rs index a9cefb65f49..a84d43d3dee 100644 --- a/src/bootstrap/flags.rs +++ b/src/bootstrap/flags.rs @@ -274,14 +274,14 @@ Arguments: } "test" => { Subcommand::Test { - paths: paths, + paths, test_args: matches.opt_strs("test-args"), fail_fast: !matches.opt_present("no-fail-fast"), } } "bench" => { Subcommand::Bench { - paths: paths, + paths, test_args: matches.opt_strs("test-args"), } } @@ -297,12 +297,12 @@ Arguments: } "dist" => { Subcommand::Dist { - paths: paths, + paths, } } "install" => { Subcommand::Install { - paths: paths, + paths, } } _ => { @@ -324,7 +324,7 @@ Arguments: Flags { verbose: matches.opt_count("verbose"), - stage: stage, + stage, on_fail: matches.opt_str("on-fail"), keep_stage: matches.opt_str("keep-stage").map(|j| j.parse().unwrap()), build: matches.opt_str("build").map(|s| INTERNER.intern_string(s)), @@ -333,9 +333,9 @@ Arguments: target: split(matches.opt_strs("target")) .into_iter().map(|x| INTERNER.intern_string(x)).collect::>(), config: cfg_file, - src: src, + src, jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()), - cmd: cmd, + cmd, incremental: matches.opt_present("incremental"), } } diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs index 1452a38f6ed..17f8bcdf03d 100644 --- a/src/bootstrap/lib.rs +++ b/src/bootstrap/lib.rs @@ -314,19 +314,19 @@ impl Build { hosts: config.hosts.clone(), targets: config.targets.clone(), - config: config, - src: src, - out: out, + config, + src, + out, - rust_info: rust_info, - cargo_info: cargo_info, - rls_info: rls_info, + rust_info, + cargo_info, + rls_info, cc: HashMap::new(), cxx: HashMap::new(), crates: HashMap::new(), lldb_version: None, lldb_python_dir: None, - is_sudo: is_sudo, + is_sudo, ci_env: CiEnv::current(), delayed_failures: Cell::new(0), } diff --git a/src/bootstrap/metadata.rs b/src/bootstrap/metadata.rs index ad555be877a..5f1df1d26e2 100644 --- a/src/bootstrap/metadata.rs +++ b/src/bootstrap/metadata.rs @@ -75,10 +75,10 @@ fn build_krate(build: &mut Build, krate: &str) { doc_step: format!("doc-crate-{}", name), test_step: format!("test-crate-{}", name), bench_step: format!("bench-crate-{}", name), - name: name, + name, version: package.version, deps: Vec::new(), - path: path, + path, }); } } diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index daf556795fa..b967eaaaab5 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -278,7 +278,7 @@ impl Arc { let x: Box<_> = box ArcInner { strong: atomic::AtomicUsize::new(1), weak: atomic::AtomicUsize::new(1), - data: data, + data, }; Arc { ptr: Shared::from(Box::into_unique(x)) } } diff --git a/src/liballoc/binary_heap.rs b/src/liballoc/binary_heap.rs index 988f8851625..57640af816a 100644 --- a/src/liballoc/binary_heap.rs +++ b/src/liballoc/binary_heap.rs @@ -853,9 +853,9 @@ impl<'a, T> Hole<'a, T> { debug_assert!(pos < data.len()); let elt = ptr::read(&data[pos]); Hole { - data: data, + data, elt: Some(elt), - pos: pos, + pos, } } @@ -1203,7 +1203,7 @@ where T: Clone + Ord { let place = Placer::make_place(self.data.place_back()); BinaryHeapPlace { heap: ptr, - place: place, + place, } } } diff --git a/src/liballoc/boxed.rs b/src/liballoc/boxed.rs index 6318d22059f..c0d43d9c527 100644 --- a/src/liballoc/boxed.rs +++ b/src/liballoc/boxed.rs @@ -169,7 +169,7 @@ fn make_place() -> IntermediateBox { IntermediateBox { ptr: p, - layout: layout, + layout, marker: marker::PhantomData, } } diff --git a/src/liballoc/btree/map.rs b/src/liballoc/btree/map.rs index a51c70159db..f733c3332e2 100644 --- a/src/liballoc/btree/map.rs +++ b/src/liballoc/btree/map.rs @@ -234,7 +234,7 @@ impl super::Recover for BTreeMap match search::search_tree(self.root.as_mut(), key) { Found(handle) => { Some(OccupiedEntry { - handle: handle, + handle, length: &mut self.length, _marker: PhantomData, } @@ -250,8 +250,8 @@ impl super::Recover for BTreeMap Found(handle) => Some(mem::replace(handle.into_kv_mut().0, key)), GoDown(handle) => { VacantEntry { - key: key, - handle: handle, + key, + handle, length: &mut self.length, _marker: PhantomData, } @@ -695,7 +695,7 @@ impl BTreeMap { match search::search_tree(self.root.as_mut(), key) { Found(handle) => { Some(OccupiedEntry { - handle: handle, + handle, length: &mut self.length, _marker: PhantomData, } @@ -866,15 +866,15 @@ impl BTreeMap { match search::search_tree(self.root.as_mut(), &key) { Found(handle) => { Occupied(OccupiedEntry { - handle: handle, + handle, length: &mut self.length, _marker: PhantomData, }) } GoDown(handle) => { Vacant(VacantEntry { - key: key, - handle: handle, + key, + handle, length: &mut self.length, _marker: PhantomData, }) diff --git a/src/liballoc/btree/node.rs b/src/liballoc/btree/node.rs index 0e61905131f..b057c18fca8 100644 --- a/src/liballoc/btree/node.rs +++ b/src/liballoc/btree/node.rs @@ -776,8 +776,8 @@ impl Handle, mar debug_assert!(idx < node.len()); Handle { - node: node, - idx: idx, + node, + idx, _marker: PhantomData } } @@ -850,8 +850,8 @@ impl debug_assert!(idx <= node.len()); Handle { - node: node, - idx: idx, + node, + idx, _marker: PhantomData } } @@ -1149,7 +1149,7 @@ impl<'a, K, V> Handle, K, V, marker::Internal>, marker:: let mut new_root = Root { node: BoxedNode::from_internal(new_node), - height: height + height, }; for i in 0..(new_len+1) { @@ -1449,12 +1449,12 @@ impl > { match self.node.force() { ForceResult::Leaf(node) => ForceResult::Leaf(Handle { - node: node, + node, idx: self.idx, _marker: PhantomData }), ForceResult::Internal(node) => ForceResult::Internal(Handle { - node: node, + node, idx: self.idx, _marker: PhantomData }) diff --git a/src/liballoc/linked_list.rs b/src/liballoc/linked_list.rs index 850dd6adcf0..f9512cbe977 100644 --- a/src/liballoc/linked_list.rs +++ b/src/liballoc/linked_list.rs @@ -140,7 +140,7 @@ impl Node { Node { next: None, prev: None, - element: element, + element, } } @@ -924,7 +924,7 @@ impl<'a, T> IterMut<'a, T> { let node = Some(Shared::from(Box::into_unique(box Node { next: Some(head), prev: Some(prev), - element: element, + element, }))); prev.as_mut().next = node; diff --git a/src/liballoc/raw_vec.rs b/src/liballoc/raw_vec.rs index 6090fc3942a..9a8614895f3 100644 --- a/src/liballoc/raw_vec.rs +++ b/src/liballoc/raw_vec.rs @@ -60,8 +60,8 @@ impl RawVec { // Unique::empty() doubles as "unallocated" and "zero-sized allocation" RawVec { ptr: Unique::empty(), - cap: cap, - a: a, + cap, + a, } } @@ -104,8 +104,8 @@ impl RawVec { RawVec { ptr: Unique::new_unchecked(ptr as *mut _), - cap: cap, - a: a, + cap, + a, } } } @@ -159,8 +159,8 @@ impl RawVec { pub unsafe fn from_raw_parts_in(ptr: *mut T, cap: usize, a: A) -> Self { RawVec { ptr: Unique::new_unchecked(ptr), - cap: cap, - a: a, + cap, + a, } } } @@ -176,7 +176,7 @@ impl RawVec { pub unsafe fn from_raw_parts(ptr: *mut T, cap: usize) -> Self { RawVec { ptr: Unique::new_unchecked(ptr), - cap: cap, + cap, a: Heap, } } diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index a2184054b37..9783aed895f 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -311,7 +311,7 @@ impl Rc { ptr: Shared::from(Box::into_unique(box RcBox { strong: Cell::new(1), weak: Cell::new(1), - value: value, + value, })), } } diff --git a/src/liballoc/slice.rs b/src/liballoc/slice.rs index ec7a2b6d0e8..356ca7a5f5e 100644 --- a/src/liballoc/slice.rs +++ b/src/liballoc/slice.rs @@ -1886,7 +1886,7 @@ fn merge_sort(v: &mut [T], mut is_less: F) // Push this run onto the stack. runs.push(Run { - start: start, + start, len: end - start, }); end = start; diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index a913d833a90..76ee0158a62 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -1378,8 +1378,8 @@ impl String { let chars_iter = self[start..end].chars(); Drain { - start: start, - end: end, + start, + end, iter: chars_iter, string: self_ptr, } @@ -1442,11 +1442,11 @@ impl String { let chars_iter = self[start..end].chars(); Splice { - start: start, - end: end, + start, + end, iter: chars_iter, string: self_ptr, - replace_with: replace_with + replace_with, } } diff --git a/src/liballoc/vec.rs b/src/liballoc/vec.rs index 5f68e59289d..77e22a3ceb2 100644 --- a/src/liballoc/vec.rs +++ b/src/liballoc/vec.rs @@ -1728,9 +1728,9 @@ impl IntoIterator for Vec { mem::forget(self); IntoIter { buf: Shared::new_unchecked(begin), - cap: cap, + cap, ptr: begin, - end: end, + end, } } } diff --git a/src/liballoc/vec_deque.rs b/src/liballoc/vec_deque.rs index 2068c2c9c5f..bf906920029 100644 --- a/src/liballoc/vec_deque.rs +++ b/src/liballoc/vec_deque.rs @@ -2442,7 +2442,7 @@ impl From> for VecDeque { VecDeque { tail: 0, head: len, - buf: buf, + buf, } } } diff --git a/src/libcore/fmt/builders.rs b/src/libcore/fmt/builders.rs index 322df6e5b47..8125097d7d1 100644 --- a/src/libcore/fmt/builders.rs +++ b/src/libcore/fmt/builders.rs @@ -18,7 +18,7 @@ struct PadAdapter<'a, 'b: 'a> { impl<'a, 'b: 'a> PadAdapter<'a, 'b> { fn new(fmt: &'a mut fmt::Formatter<'b>) -> PadAdapter<'a, 'b> { PadAdapter { - fmt: fmt, + fmt, on_newline: false, } } @@ -94,8 +94,8 @@ pub fn debug_struct_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, -> DebugStruct<'a, 'b> { let result = fmt.write_str(name); DebugStruct { - fmt: fmt, - result: result, + fmt, + result, has_fields: false, } } @@ -185,8 +185,8 @@ pub struct DebugTuple<'a, 'b: 'a> { pub fn debug_tuple_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>, name: &str) -> DebugTuple<'a, 'b> { let result = fmt.write_str(name); DebugTuple { - fmt: fmt, - result: result, + fmt, + result, fields: 0, empty_name: name.is_empty(), } @@ -317,8 +317,8 @@ pub fn debug_set_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugSet<'a, 'b let result = write!(fmt, "{{"); DebugSet { inner: DebugInner { - fmt: fmt, - result: result, + fmt, + result, has_fields: false, }, } @@ -388,8 +388,8 @@ pub fn debug_list_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugList<'a, let result = write!(fmt, "["); DebugList { inner: DebugInner { - fmt: fmt, - result: result, + fmt, + result, has_fields: false, }, } @@ -460,8 +460,8 @@ pub struct DebugMap<'a, 'b: 'a> { pub fn debug_map_new<'a, 'b>(fmt: &'a mut fmt::Formatter<'b>) -> DebugMap<'a, 'b> { let result = write!(fmt, "{{"); DebugMap { - fmt: fmt, - result: result, + fmt, + result, has_fields: false, } } diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs index 97839844087..cf6262bda97 100644 --- a/src/libcore/fmt/mod.rs +++ b/src/libcore/fmt/mod.rs @@ -334,9 +334,9 @@ impl<'a> Arguments<'a> { pub fn new_v1(pieces: &'a [&'a str], args: &'a [ArgumentV1<'a>]) -> Arguments<'a> { Arguments { - pieces: pieces, + pieces, fmt: None, - args: args + args, } } @@ -353,9 +353,9 @@ impl<'a> Arguments<'a> { args: &'a [ArgumentV1<'a>], fmt: &'a [rt::v1::Argument]) -> Arguments<'a> { Arguments { - pieces: pieces, + pieces, fmt: Some(fmt), - args: args + args, } } diff --git a/src/libcore/iter/mod.rs b/src/libcore/iter/mod.rs index 22b997a768e..ebedfe1d743 100644 --- a/src/libcore/iter/mod.rs +++ b/src/libcore/iter/mod.rs @@ -840,8 +840,8 @@ impl ZipImpl for Zip type Item = (A::Item, B::Item); default fn new(a: A, b: B) -> Self { Zip { - a: a, - b: b, + a, + b, index: 0, // unused len: 0, // unused } @@ -903,10 +903,10 @@ impl ZipImpl for Zip fn new(a: A, b: B) -> Self { let len = cmp::min(a.len(), b.len()); Zip { - a: a, - b: b, + a, + b, index: 0, - len: len, + len, } } diff --git a/src/libcore/iter/traits.rs b/src/libcore/iter/traits.rs index 19098f036ac..2af129a67bd 100644 --- a/src/libcore/iter/traits.rs +++ b/src/libcore/iter/traits.rs @@ -744,7 +744,7 @@ impl ResultShunt fn new(iter: I) -> Self { ResultShunt { - iter: iter, + iter, error: None, } } diff --git a/src/libcore/num/diy_float.rs b/src/libcore/num/diy_float.rs index 6635d95155f..97bcba2f2ff 100644 --- a/src/libcore/num/diy_float.rs +++ b/src/libcore/num/diy_float.rs @@ -86,7 +86,7 @@ impl Fp { assert_eq!(self.f << edelta >> edelta, self.f); Fp { f: self.f << edelta, - e: e, + e, } } } diff --git a/src/libcore/num/flt2dec/mod.rs b/src/libcore/num/flt2dec/mod.rs index 74b9e7bf37d..beaa6e140a6 100644 --- a/src/libcore/num/flt2dec/mod.rs +++ b/src/libcore/num/flt2dec/mod.rs @@ -442,7 +442,7 @@ pub fn to_shortest_str<'a, T, F>(mut format_shortest: F, v: T, } FullDecoded::Finite(ref decoded) => { let (len, exp) = format_shortest(decoded, buf); - Formatted { sign: sign, + Formatted { sign, parts: digits_to_dec_str(&buf[..len], exp, frac_digits, parts) } } } @@ -581,7 +581,7 @@ pub fn to_exact_exp_str<'a, T, F>(mut format_exact: F, v: T, let trunc = if ndigits < maxlen { ndigits } else { maxlen }; let (len, exp) = format_exact(decoded, &mut buf[..trunc], i16::MIN); - Formatted { sign: sign, + Formatted { sign, parts: digits_to_exp_str(&buf[..len], exp, ndigits, upper, parts) } } } @@ -652,7 +652,7 @@ pub fn to_exact_fixed_str<'a, T, F>(mut format_exact: F, v: T, Formatted { sign: sign, parts: &parts[..1] } } } else { - Formatted { sign: sign, + Formatted { sign, parts: digits_to_dec_str(&buf[..len], exp, frac_digits, parts) } } } diff --git a/src/libcore/slice/mod.rs b/src/libcore/slice/mod.rs index fa0c482e55c..0509936153c 100644 --- a/src/libcore/slice/mod.rs +++ b/src/libcore/slice/mod.rs @@ -300,7 +300,7 @@ impl SliceExt for [T] { { Split { v: self, - pred: pred, + pred, finished: false } } diff --git a/src/libcore/str/mod.rs b/src/libcore/str/mod.rs index 4c99fe97daf..a5f6e49a53b 100644 --- a/src/libcore/str/mod.rs +++ b/src/libcore/str/mod.rs @@ -2233,7 +2233,7 @@ impl StrExt for str { fn splitn<'a, P: Pattern<'a>>(&'a self, count: usize, pat: P) -> SplitN<'a, P> { SplitN(SplitNInternal { iter: self.split(pat).0, - count: count, + count, }) } diff --git a/src/libcore/str/pattern.rs b/src/libcore/str/pattern.rs index c4ff95b1d6a..edb7bed4520 100644 --- a/src/libcore/str/pattern.rs +++ b/src/libcore/str/pattern.rs @@ -290,7 +290,7 @@ impl<'a, C: CharEq> Pattern<'a> for CharEqPattern { fn into_searcher(self, haystack: &'a str) -> CharEqSearcher<'a, C> { CharEqSearcher { ascii_only: self.0.only_ascii(), - haystack: haystack, + haystack, char_eq: self.0, char_indices: haystack.char_indices(), } @@ -596,8 +596,8 @@ impl<'a, 'b> StrSearcher<'a, 'b> { fn new(haystack: &'a str, needle: &'b str) -> StrSearcher<'a, 'b> { if needle.is_empty() { StrSearcher { - haystack: haystack, - needle: needle, + haystack, + needle, searcher: StrSearcherImpl::Empty(EmptyNeedle { position: 0, end: haystack.len(), @@ -607,8 +607,8 @@ impl<'a, 'b> StrSearcher<'a, 'b> { } } else { StrSearcher { - haystack: haystack, - needle: needle, + haystack, + needle, searcher: StrSearcherImpl::TwoWay( TwoWaySearcher::new(needle.as_bytes(), haystack.len()) ), @@ -899,13 +899,13 @@ impl TwoWaySearcher { TwoWaySearcher::reverse_maximal_suffix(needle, period, true)); TwoWaySearcher { - crit_pos: crit_pos, - crit_pos_back: crit_pos_back, - period: period, + crit_pos, + crit_pos_back, + period, byteset: Self::byteset_create(&needle[..period]), position: 0, - end: end, + end, memory: 0, memory_back: needle.len(), } @@ -918,13 +918,13 @@ impl TwoWaySearcher { // reverse search. TwoWaySearcher { - crit_pos: crit_pos, + crit_pos, crit_pos_back: crit_pos, period: cmp::max(crit_pos, needle.len() - crit_pos) + 1, byteset: Self::byteset_create(needle), position: 0, - end: end, + end, memory: usize::MAX, // Dummy value to signify that the period is long memory_back: usize::MAX, } diff --git a/src/libcore/tests/iter.rs b/src/libcore/tests/iter.rs index a1249a5f22c..ed6923929d6 100644 --- a/src/libcore/tests/iter.rs +++ b/src/libcore/tests/iter.rs @@ -392,7 +392,7 @@ pub struct CycleIter<'a, T: 'a> { pub fn cycle(data: &[T]) -> CycleIter { CycleIter { index: 0, - data: data, + data, } } diff --git a/src/libcore/tests/option.rs b/src/libcore/tests/option.rs index 51b0655f680..6bac55575fb 100644 --- a/src/libcore/tests/option.rs +++ b/src/libcore/tests/option.rs @@ -53,7 +53,7 @@ fn test_get_resource() { fn r(i: Rc>) -> R { R { - i: i + i, } } diff --git a/src/libfmt_macros/lib.rs b/src/libfmt_macros/lib.rs index 493ce04f672..43345c6d097 100644 --- a/src/libfmt_macros/lib.rs +++ b/src/libfmt_macros/lib.rs @@ -284,7 +284,7 @@ impl<'a> Parser<'a> { Argument { position: pos, - format: format, + format, } } diff --git a/src/libgetopts/lib.rs b/src/libgetopts/lib.rs index f41fc5aa29f..83f2de54023 100644 --- a/src/libgetopts/lib.rs +++ b/src/libgetopts/lib.rs @@ -250,28 +250,28 @@ impl OptGroup { (0, _) => { Opt { name: Long((long_name)), - hasarg: hasarg, - occur: occur, + hasarg, + occur, aliases: Vec::new(), } } (1, 0) => { Opt { name: Short(short_name.chars().next().unwrap()), - hasarg: hasarg, - occur: occur, + hasarg, + occur, aliases: Vec::new(), } } (1, _) => { Opt { name: Long((long_name)), - hasarg: hasarg, - occur: occur, + hasarg, + occur, aliases: vec![Opt { name: Short(short_name.chars().next().unwrap()), - hasarg: hasarg, - occur: occur, + hasarg, + occur, aliases: Vec::new(), }], } @@ -530,8 +530,8 @@ pub fn opt(short_name: &str, long_name: long_name.to_owned(), hint: hint.to_owned(), desc: desc.to_owned(), - hasarg: hasarg, - occur: occur, + hasarg, + occur, } } @@ -681,9 +681,9 @@ pub fn getopts(args: &[String], optgrps: &[OptGroup]) -> Result { } } Ok(Matches { - opts: opts, - vals: vals, - free: free, + opts, + vals, + free, }) } diff --git a/src/libgraphviz/lib.rs b/src/libgraphviz/lib.rs index c01938f5e11..d66fba18f47 100644 --- a/src/libgraphviz/lib.rs +++ b/src/libgraphviz/lib.rs @@ -781,10 +781,10 @@ mod tests { fn edge(from: usize, to: usize, label: &'static str, style: Style) -> Edge { Edge { - from: from, - to: to, - label: label, - style: style, + from, + to, + label, + style, } } @@ -848,9 +848,9 @@ mod tests { -> LabelledGraph { let count = node_labels.len(); LabelledGraph { - name: name, + name, node_labels: node_labels.to_opt_strs(), - edges: edges, + edges, node_styles: match node_styles { Some(nodes) => nodes, None => vec![Style::None; count], diff --git a/src/libpanic_unwind/gcc.rs b/src/libpanic_unwind/gcc.rs index aadbeb96b2d..63e44f71a3a 100644 --- a/src/libpanic_unwind/gcc.rs +++ b/src/libpanic_unwind/gcc.rs @@ -74,7 +74,7 @@ pub unsafe fn panic(data: Box) -> u32 { let exception = Box::new(Exception { _uwe: uw::_Unwind_Exception { exception_class: rust_exception_class(), - exception_cleanup: exception_cleanup, + exception_cleanup, private: [0; uw::unwinder_private_data_size], }, cause: Some(data), diff --git a/src/librand/distributions/gamma.rs b/src/librand/distributions/gamma.rs index 9a42b82beff..188e71f3fa9 100644 --- a/src/librand/distributions/gamma.rs +++ b/src/librand/distributions/gamma.rs @@ -127,9 +127,9 @@ impl GammaLargeShape { fn new_raw(shape: f64, scale: f64) -> GammaLargeShape { let d = shape - 1. / 3.; GammaLargeShape { - scale: scale, + scale, c: 1. / (9. * d).sqrt(), - d: d, + d, } } } diff --git a/src/librand/distributions/mod.rs b/src/librand/distributions/mod.rs index 67b9449981e..47967a719d3 100644 --- a/src/librand/distributions/mod.rs +++ b/src/librand/distributions/mod.rs @@ -149,7 +149,7 @@ impl<'a, T: Clone> WeightedChoice<'a, T> { "WeightedChoice::new called with a total weight of 0"); WeightedChoice { - items: items, + items, // we're likely to be generating numbers in this range // relatively often, so might as well cache it weight_range: Range::new(0, running_total), diff --git a/src/librand/distributions/normal.rs b/src/librand/distributions/normal.rs index 33de11ab630..e1518dab21c 100644 --- a/src/librand/distributions/normal.rs +++ b/src/librand/distributions/normal.rs @@ -103,8 +103,8 @@ impl Normal { pub fn new(mean: f64, std_dev: f64) -> Normal { assert!(std_dev >= 0.0, "Normal::new called with `std_dev` < 0"); Normal { - mean: mean, - std_dev: std_dev, + mean, + std_dev, } } } diff --git a/src/librand/distributions/range.rs b/src/librand/distributions/range.rs index be238b0b1ab..f2f8132e5b4 100644 --- a/src/librand/distributions/range.rs +++ b/src/librand/distributions/range.rs @@ -104,7 +104,7 @@ macro_rules! integer_impl { let zone = unsigned_max - unsigned_max % range; Range { - low: low, + low, range: range as $ty, accept_zone: zone as $ty } @@ -143,7 +143,7 @@ macro_rules! float_impl { impl SampleRange for $ty { fn construct_range(low: $ty, high: $ty) -> Range<$ty> { Range { - low: low, + low, range: high - low, accept_zone: 0.0 // unused } diff --git a/src/librand/lib.rs b/src/librand/lib.rs index 5e56b0d8ab1..a1b6ddcb331 100644 --- a/src/librand/lib.rs +++ b/src/librand/lib.rs @@ -418,10 +418,10 @@ impl Rand for XorShiftRng { } let (x, y, z, w) = tuple; XorShiftRng { - x: x, - y: y, - z: z, - w: w, + x, + y, + z, + w, } } } diff --git a/src/librand/reseeding.rs b/src/librand/reseeding.rs index 21684e38f7b..804fe9dc63c 100644 --- a/src/librand/reseeding.rs +++ b/src/librand/reseeding.rs @@ -38,10 +38,10 @@ impl> ReseedingRng { /// * `reseeder`: the reseeding object to use. pub fn new(rng: R, generation_threshold: usize, reseeder: Rsdr) -> ReseedingRng { ReseedingRng { - rng: rng, - generation_threshold: generation_threshold, + rng, + generation_threshold, bytes_generated: 0, - reseeder: reseeder, + reseeder, } } diff --git a/src/librustc/middle/dead.rs b/src/librustc/middle/dead.rs index 8a2b115e58d..b8624722692 100644 --- a/src/librustc/middle/dead.rs +++ b/src/librustc/middle/dead.rs @@ -630,8 +630,8 @@ pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { let krate = tcx.hir.krate(); let live_symbols = find_live(tcx, access_levels, krate); let mut visitor = DeadVisitor { - tcx: tcx, - live_symbols: live_symbols, + tcx, + live_symbols, }; intravisit::walk_crate(&mut visitor, krate); } diff --git a/src/librustc/ty/context.rs b/src/librustc/ty/context.rs index f71ad67bd1d..b8f27f8741d 100644 --- a/src/librustc/ty/context.rs +++ b/src/librustc/ty/context.rs @@ -1695,8 +1695,8 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { substs: &'tcx Substs<'tcx>) -> Ty<'tcx> { self.mk_ty(TyProjection(ProjectionTy { - item_def_id: item_def_id, - substs: substs, + item_def_id, + substs, })) } diff --git a/src/librustc/ty/relate.rs b/src/librustc/ty/relate.rs index 0d9ef8196c7..c035817d66d 100644 --- a/src/librustc/ty/relate.rs +++ b/src/librustc/ty/relate.rs @@ -253,7 +253,7 @@ impl<'tcx> Relate<'tcx> for ty::ExistentialProjection<'tcx> { let substs = relation.relate(&a.substs, &b.substs)?; Ok(ty::ExistentialProjection { item_def_id: a.item_def_id, - substs: substs, + substs, ty, }) } diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 48ace804995..e41eb079b37 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -137,7 +137,7 @@ impl<'a, 'tcx> Lift<'tcx> for ty::ProjectionTy<'a> { tcx.lift(&self.substs).map(|substs| { ty::ProjectionTy { item_def_id: self.item_def_id, - substs: substs, + substs, } }) } diff --git a/src/librustc/ty/sty.rs b/src/librustc/ty/sty.rs index b42180b288b..389c581ebe3 100644 --- a/src/librustc/ty/sty.rs +++ b/src/librustc/ty/sty.rs @@ -569,7 +569,7 @@ impl<'a, 'tcx> ProjectionTy<'tcx> { pub fn trait_ref(&self, tcx: TyCtxt) -> ty::TraitRef<'tcx> { let def_id = tcx.associated_item(self.item_def_id).container.id(); ty::TraitRef { - def_id: def_id, + def_id, substs: self.substs, } } @@ -874,7 +874,7 @@ impl<'a, 'tcx, 'gcx> ExistentialProjection<'tcx> { pub fn trait_ref(&self, tcx: TyCtxt) -> ty::ExistentialTraitRef<'tcx> { let def_id = tcx.associated_item(self.item_def_id).container.id(); ty::ExistentialTraitRef{ - def_id: def_id, + def_id, substs: self.substs, } } diff --git a/src/librustc_allocator/expand.rs b/src/librustc_allocator/expand.rs index 78b07a33389..f99c6a29ff0 100644 --- a/src/librustc_allocator/expand.rs +++ b/src/librustc_allocator/expand.rs @@ -36,9 +36,9 @@ pub fn modify(sess: &ParseSess, krate: Crate, handler: &rustc_errors::Handler) -> ast::Crate { ExpandAllocatorDirectives { - handler: handler, - sess: sess, - resolver: resolver, + handler, + sess, + resolver, found: false, }.fold_crate(krate) } @@ -88,7 +88,7 @@ impl<'a> Folder for ExpandAllocatorDirectives<'a> { }; let ecfg = ExpansionConfig::default(name.to_string()); let mut f = AllocFnFactory { - span: span, + span, kind: AllocatorKind::Global, global: item.ident, alloc: Ident::from_str("alloc"), diff --git a/src/librustc_back/target/apple_ios_base.rs b/src/librustc_back/target/apple_ios_base.rs index 2e7d30d969e..4b02d0b60b8 100644 --- a/src/librustc_back/target/apple_ios_base.rs +++ b/src/librustc_back/target/apple_ios_base.rs @@ -97,7 +97,7 @@ pub fn opts(arch: Arch) -> Result { cpu: target_cpu(arch), dynamic_linking: false, executables: true, - pre_link_args: pre_link_args, + pre_link_args, has_elf_tls: false, .. super::apple_base::opts() }) diff --git a/src/librustc_back/target/l4re_base.rs b/src/librustc_back/target/l4re_base.rs index 998183d4015..d95f6fa97cf 100644 --- a/src/librustc_back/target/l4re_base.rs +++ b/src/librustc_back/target/l4re_base.rs @@ -25,7 +25,7 @@ pub fn opts() -> TargetOptions { exe_allocation_crate: Some("alloc_system".to_string()), panic_strategy: PanicStrategy::Abort, linker: "ld".to_string(), - pre_link_args: pre_link_args, + pre_link_args, target_family: Some("unix".to_string()), .. Default::default() } diff --git a/src/librustc_back/target/le32_unknown_nacl.rs b/src/librustc_back/target/le32_unknown_nacl.rs index f4265e0eb14..51eeae50e22 100644 --- a/src/librustc_back/target/le32_unknown_nacl.rs +++ b/src/librustc_back/target/le32_unknown_nacl.rs @@ -25,8 +25,8 @@ pub fn target() -> TargetResult { linker: "pnacl-clang".to_string(), ar: "pnacl-ar".to_string(), - pre_link_args: pre_link_args, - post_link_args: post_link_args, + pre_link_args, + post_link_args, dynamic_linking: false, executables: true, exe_suffix: ".pexe".to_string(), diff --git a/src/librustc_back/target/wasm32_experimental_emscripten.rs b/src/librustc_back/target/wasm32_experimental_emscripten.rs index db47040bf3a..42ab1940404 100644 --- a/src/librustc_back/target/wasm32_experimental_emscripten.rs +++ b/src/librustc_back/target/wasm32_experimental_emscripten.rs @@ -38,7 +38,7 @@ pub fn target() -> Result { obj_is_bitcode: true, is_like_emscripten: true, max_atomic_width: Some(32), - post_link_args: post_link_args, + post_link_args, target_family: Some("unix".to_string()), .. Default::default() }; diff --git a/src/librustc_back/target/wasm32_unknown_emscripten.rs b/src/librustc_back/target/wasm32_unknown_emscripten.rs index f5fb63038e9..a0a2699d8f9 100644 --- a/src/librustc_back/target/wasm32_unknown_emscripten.rs +++ b/src/librustc_back/target/wasm32_unknown_emscripten.rs @@ -34,7 +34,7 @@ pub fn target() -> Result { obj_is_bitcode: true, is_like_emscripten: true, max_atomic_width: Some(32), - post_link_args: post_link_args, + post_link_args, target_family: Some("unix".to_string()), .. Default::default() }; diff --git a/src/librustc_back/target/windows_base.rs b/src/librustc_back/target/windows_base.rs index 9bde24a28dd..e6aa745d54e 100644 --- a/src/librustc_back/target/windows_base.rs +++ b/src/librustc_back/target/windows_base.rs @@ -78,7 +78,7 @@ pub fn opts() -> TargetOptions { target_family: Some("windows".to_string()), is_like_windows: true, allows_weak_linkage: false, - pre_link_args: pre_link_args, + pre_link_args, pre_link_objects_exe: vec![ "crt2.o".to_string(), // mingw C runtime initialization for executables "rsbegin.o".to_string(), // Rust compiler runtime initialization, see rsbegin.rs @@ -87,7 +87,7 @@ pub fn opts() -> TargetOptions { "dllcrt2.o".to_string(), // mingw C runtime initialization for dlls "rsbegin.o".to_string(), ], - late_link_args: late_link_args, + late_link_args, post_link_objects: vec![ "rsend.o".to_string() ], diff --git a/src/librustc_borrowck/borrowck/check_loans.rs b/src/librustc_borrowck/borrowck/check_loans.rs index c34bf4c3d28..c8237717325 100644 --- a/src/librustc_borrowck/borrowck/check_loans.rs +++ b/src/librustc_borrowck/borrowck/check_loans.rs @@ -194,10 +194,10 @@ pub fn check_loans<'a, 'b, 'c, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, let def_id = bccx.tcx.hir.body_owner_def_id(body.id()); let param_env = bccx.tcx.param_env(def_id); let mut clcx = CheckLoanCtxt { - bccx: bccx, - dfcx_loans: dfcx_loans, - move_data: move_data, - all_loans: all_loans, + bccx, + dfcx_loans, + move_data, + all_loans, param_env, }; euv::ExprUseVisitor::new(&mut clcx, bccx.tcx, param_env, &bccx.region_maps, bccx.tables) diff --git a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs index 3d98c2a23dc..bca980c5ccf 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/gather_moves.rs @@ -106,8 +106,8 @@ pub fn gather_move_from_expr<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, }; let move_info = GatherMoveInfo { id: move_expr_id, - kind: kind, - cmt: cmt, + kind, + cmt, span_path_opt: None, }; gather_move(bccx, move_data, move_error_collector, move_info); @@ -163,7 +163,7 @@ pub fn gather_move_from_pat<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, let move_info = GatherMoveInfo { id: move_pat.id, kind: MovePat, - cmt: cmt, + cmt, span_path_opt: pat_span_path_opt, }; diff --git a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs index 89c60da3969..22de3c75913 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/lifetime.rs @@ -37,10 +37,10 @@ pub fn guarantee_lifetime<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, debug!("guarantee_lifetime(cmt={:?}, loan_region={:?})", cmt, loan_region); let ctxt = GuaranteeLifetimeContext {bccx: bccx, - item_scope: item_scope, - span: span, - cause: cause, - loan_region: loan_region, + item_scope, + span, + cause, + loan_region, cmt_original: cmt.clone()}; ctxt.check(&cmt, None) } diff --git a/src/librustc_borrowck/borrowck/gather_loans/mod.rs b/src/librustc_borrowck/borrowck/gather_loans/mod.rs index 35af83c8ae2..4ff603b7eae 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/mod.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/mod.rs @@ -41,7 +41,7 @@ pub fn gather_loans_in_fn<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, let def_id = bccx.tcx.hir.body_owner_def_id(body); let param_env = bccx.tcx.param_env(def_id); let mut glcx = GatherLoanCtxt { - bccx: bccx, + bccx, all_loans: Vec::new(), item_ub: region::CodeExtent::Misc(body.node_id), move_data: MoveData::new(), @@ -230,8 +230,8 @@ fn check_mutability<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, // Only mutable data can be lent as mutable. if !cmt.mutbl.is_mutable() { Err(bccx.report(BckError { span: borrow_span, - cause: cause, - cmt: cmt, + cause, + cmt, code: err_mutbl })) } else { Ok(()) @@ -389,13 +389,13 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { Loan { index: self.all_loans.len(), - loan_path: loan_path, + loan_path, kind: req_kind, - gen_scope: gen_scope, - kill_scope: kill_scope, + gen_scope, + kill_scope, span: borrow_span, - restricted_paths: restricted_paths, - cause: cause, + restricted_paths, + cause, } } }; @@ -423,13 +423,13 @@ impl<'a, 'tcx> GatherLoanCtxt<'a, 'tcx> { // let all_loans = &mut *self.all_loans; // FIXME(#5074) // Loan { // index: all_loans.len(), - // loan_path: loan_path, - // cmt: cmt, + // loan_path, + // cmt, // mutbl: ConstMutability, // gen_scope: borrow_id, - // kill_scope: kill_scope, + // kill_scope, // span: borrow_span, - // restrictions: restrictions + // restrictions, // } // } } diff --git a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs index bfd883be848..31a0312ef96 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/move_error.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/move_error.rs @@ -49,8 +49,8 @@ impl<'tcx> MoveError<'tcx> { move_to: Option>) -> MoveError<'tcx> { MoveError { - move_from: move_from, - move_to: move_to, + move_from, + move_to, } } } diff --git a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs index b7965f81b88..bc01f22d388 100644 --- a/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs +++ b/src/librustc_borrowck/borrowck/gather_loans/restrictions.rs @@ -34,10 +34,10 @@ pub fn compute_restrictions<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>, loan_region: ty::Region<'tcx>) -> RestrictionResult<'tcx> { let ctxt = RestrictionsContext { - bccx: bccx, - span: span, - cause: cause, - loan_region: loan_region, + bccx, + span, + cause, + loan_region, }; ctxt.restrict(cmt) diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index 412af05f5bd..9514b9b39fd 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -180,7 +180,7 @@ fn build_borrowck_dataflow_data<'a, 'c, 'tcx, F>(this: &mut BorrowckCtxt<'a, 'tc id_range, body); - Some(AnalysisData { all_loans: all_loans, + Some(AnalysisData { all_loans, loans: loan_dfcx, move_data:flowed_moves }) } diff --git a/src/librustc_borrowck/borrowck/move_data.rs b/src/librustc_borrowck/borrowck/move_data.rs index fd80e8320d6..5a08d638291 100644 --- a/src/librustc_borrowck/borrowck/move_data.rs +++ b/src/librustc_borrowck/borrowck/move_data.rs @@ -310,7 +310,7 @@ impl<'a, 'tcx> MoveData<'tcx> { parent: parent_index, first_move: InvalidMoveIndex, first_child: InvalidMovePathIndex, - next_sibling: next_sibling, + next_sibling, }); index @@ -408,9 +408,9 @@ impl<'a, 'tcx> MoveData<'tcx> { self.moves.borrow_mut().push(Move { path: path_index, - id: id, - kind: kind, - next_move: next_move + id, + kind, + next_move, }); } @@ -468,8 +468,8 @@ impl<'a, 'tcx> MoveData<'tcx> { let assignment = Assignment { path: path_index, id: assign_id, - span: span, - assignee_id: assignee_id, + span, + assignee_id, }; if self.is_var_path(path_index) { @@ -504,7 +504,7 @@ impl<'a, 'tcx> MoveData<'tcx> { path: path_index, base_path: base_path_index, id: pattern_id, - mode: mode, + mode, }; self.variant_matches.borrow_mut().push(variant_match); @@ -680,9 +680,9 @@ impl<'a, 'tcx> FlowedMoveData<'a, 'tcx> { dfcx_assign.propagate(cfg, body); FlowedMoveData { - move_data: move_data, - dfcx_moves: dfcx_moves, - dfcx_assign: dfcx_assign, + move_data, + dfcx_moves, + dfcx_assign, } } diff --git a/src/librustc_const_eval/_match.rs b/src/librustc_const_eval/_match.rs index bae44c0047e..bc9aa9665c1 100644 --- a/src/librustc_const_eval/_match.rs +++ b/src/librustc_const_eval/_match.rs @@ -166,8 +166,8 @@ impl<'a, 'tcx> MatchCheckCtxt<'a, 'tcx> { let pattern_arena = TypedArena::new(); f(MatchCheckCtxt { - tcx: tcx, - module: module, + tcx, + module, pattern_arena: &pattern_arena, byte_array_map: FxHashMap(), }) @@ -296,7 +296,7 @@ impl<'tcx> Witness<'tcx> { let sub_pattern_tys = constructor_sub_pattern_tys(cx, ctor, ty); self.0.extend(sub_pattern_tys.into_iter().map(|ty| { Pattern { - ty: ty, + ty, span: DUMMY_SP, kind: box PatternKind::Wild, } @@ -344,7 +344,7 @@ impl<'tcx> Witness<'tcx> { if adt.variants.len() > 1 { PatternKind::Variant { adt_def: adt, - substs: substs, + substs, variant_index: ctor.variant_index_for_adt(adt), subpatterns: pats } @@ -378,7 +378,7 @@ impl<'tcx> Witness<'tcx> { }; self.0.push(Pattern { - ty: ty, + ty, span: DUMMY_SP, kind: Box::new(pat), }); @@ -673,7 +673,7 @@ fn is_useful_specialized<'p, 'a:'p, 'tcx: 'a>( let sub_pat_tys = constructor_sub_pattern_tys(cx, &ctor, lty); let wild_patterns_owned: Vec<_> = sub_pat_tys.iter().map(|ty| { Pattern { - ty: ty, + ty, span: DUMMY_SP, kind: box PatternKind::Wild, } diff --git a/src/librustc_const_eval/check_match.rs b/src/librustc_const_eval/check_match.rs index ea7deef4724..2bed1950afc 100644 --- a/src/librustc_const_eval/check_match.rs +++ b/src/librustc_const_eval/check_match.rs @@ -524,7 +524,7 @@ fn check_legality_of_move_bindings(cx: &MatchVisitor, /// FIXME: this should be done by borrowck. fn check_for_mutation_in_guard(cx: &MatchVisitor, guard: &hir::Expr) { let mut checker = MutationChecker { - cx: cx, + cx, }; ExprUseVisitor::new(&mut checker, cx.tcx, cx.param_env, cx.region_maps, cx.tables) .walk_expr(guard); diff --git a/src/librustc_const_eval/eval.rs b/src/librustc_const_eval/eval.rs index 20ca218571c..c7def0b834c 100644 --- a/src/librustc_const_eval/eval.rs +++ b/src/librustc_const_eval/eval.rs @@ -379,7 +379,7 @@ fn eval_const_expr_partial<'a, 'tcx>(cx: &ConstContext<'a, 'tcx>, tcx, param_env: cx.param_env, tables: tcx.typeck_tables_of(def_id), - substs: substs, + substs, fn_args: Some(call_args) }; callee_cx.eval(&body.value)? diff --git a/src/librustc_const_eval/pattern.rs b/src/librustc_const_eval/pattern.rs index d151e817040..ba79f775ef7 100644 --- a/src/librustc_const_eval/pattern.rs +++ b/src/librustc_const_eval/pattern.rs @@ -407,8 +407,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { } PatternKind::Binding { - mutability: mutability, - mode: mode, + mutability, + mode, name: ident.node, var: id, ty: var_ty, @@ -470,7 +470,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { Pattern { span: pat.span, - ty: ty, + ty, kind: Box::new(kind), } } @@ -569,10 +569,10 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { _ => bug!("inappropriate type for def: {:?}", ty.sty), }; PatternKind::Variant { - adt_def: adt_def, - substs: substs, + adt_def, + substs, variant_index: adt_def.variant_index_with_id(variant_id), - subpatterns: subpatterns, + subpatterns, } } else { PatternKind::Leaf { subpatterns: subpatterns } @@ -626,8 +626,8 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { }; Pattern { - span: span, - ty: ty, + span, + ty, kind: Box::new(kind), } } @@ -762,7 +762,7 @@ impl<'a, 'tcx> PatternContext<'a, 'tcx> { }; Pattern { - span: span, + span, ty: pat_ty, kind: Box::new(kind), } diff --git a/src/librustc_data_structures/array_vec.rs b/src/librustc_data_structures/array_vec.rs index df660d08603..1e67461e055 100644 --- a/src/librustc_data_structures/array_vec.rs +++ b/src/librustc_data_structures/array_vec.rs @@ -281,8 +281,8 @@ impl IntoIterator for ArrayVec { let indices = 0..self.count; mem::forget(self); Iter { - indices: indices, - store: store, + indices, + store, } } } diff --git a/src/librustc_data_structures/bitvec.rs b/src/librustc_data_structures/bitvec.rs index 7fc59be780f..7331016c2d2 100644 --- a/src/librustc_data_structures/bitvec.rs +++ b/src/librustc_data_structures/bitvec.rs @@ -151,7 +151,7 @@ impl BitMatrix { // element. Round up to an even number of u64s. let u64s_per_row = u64s(columns); BitMatrix { - columns: columns, + columns, vector: vec![0; rows * u64s_per_row], } } diff --git a/src/librustc_data_structures/control_flow_graph/dominators/mod.rs b/src/librustc_data_structures/control_flow_graph/dominators/mod.rs index ab675db2150..65dd336fdbd 100644 --- a/src/librustc_data_structures/control_flow_graph/dominators/mod.rs +++ b/src/librustc_data_structures/control_flow_graph/dominators/mod.rs @@ -71,8 +71,8 @@ pub fn dominators_given_rpo(graph: &G, } Dominators { - post_order_rank: post_order_rank, - immediate_dominators: immediate_dominators, + post_order_rank, + immediate_dominators, } } @@ -181,7 +181,7 @@ impl Dominators { } DominatorTree { root: root.unwrap(), - children: children, + children, } } } diff --git a/src/librustc_data_structures/control_flow_graph/test.rs b/src/librustc_data_structures/control_flow_graph/test.rs index d48a6e684ad..f04b536bc18 100644 --- a/src/librustc_data_structures/control_flow_graph/test.rs +++ b/src/librustc_data_structures/control_flow_graph/test.rs @@ -26,7 +26,7 @@ impl TestGraph { pub fn new(start_node: usize, edges: &[(usize, usize)]) -> Self { let mut graph = TestGraph { num_nodes: start_node + 1, - start_node: start_node, + start_node, successors: HashMap::new(), predecessors: HashMap::new(), }; diff --git a/src/librustc_data_structures/control_flow_graph/transpose.rs b/src/librustc_data_structures/control_flow_graph/transpose.rs index a1a117edb94..163d65c089c 100644 --- a/src/librustc_data_structures/control_flow_graph/transpose.rs +++ b/src/librustc_data_structures/control_flow_graph/transpose.rs @@ -23,8 +23,8 @@ impl TransposedGraph { pub fn with_start(base_graph: G, start_node: G::Node) -> Self { TransposedGraph { - base_graph: base_graph, - start_node: start_node, + base_graph, + start_node, } } } diff --git a/src/librustc_data_structures/graph/mod.rs b/src/librustc_data_structures/graph/mod.rs index f562ae0e3b8..eb8342530ab 100644 --- a/src/librustc_data_structures/graph/mod.rs +++ b/src/librustc_data_structures/graph/mod.rs @@ -153,7 +153,7 @@ impl Graph { let idx = self.next_node_index(); self.nodes.push(Node { first_edge: [INVALID_EDGE_INDEX, INVALID_EDGE_INDEX], - data: data, + data, }); idx } @@ -189,9 +189,9 @@ impl Graph { // as the next pointers self.edges.push(Edge { next_edge: [source_first, target_first], - source: source, - target: target, - data: data, + source, + target, + data, }); // adjust the firsts for each node target be the next object. @@ -269,7 +269,7 @@ impl Graph { let first_edge = self.node(source).first_edge[direction.repr]; AdjacentEdges { graph: self, - direction: direction, + direction, next: first_edge, } } @@ -482,10 +482,10 @@ impl<'g, N: Debug, E: Debug> DepthFirstTraversal<'g, N, E> { pub fn new(graph: &'g Graph, direction: Direction) -> Self { let visited = BitVector::new(graph.len_nodes()); DepthFirstTraversal { - graph: graph, + graph, stack: vec![], - visited: visited, - direction: direction, + visited, + direction, } } @@ -496,10 +496,10 @@ impl<'g, N: Debug, E: Debug> DepthFirstTraversal<'g, N, E> { let mut visited = BitVector::new(graph.len_nodes()); visited.insert(start_node.node_id()); DepthFirstTraversal { - graph: graph, + graph, stack: vec![start_node], - visited: visited, - direction: direction, + visited, + direction, } } diff --git a/src/librustc_data_structures/obligation_forest/mod.rs b/src/librustc_data_structures/obligation_forest/mod.rs index 6e70944ce64..5a5bc67b592 100644 --- a/src/librustc_data_structures/obligation_forest/mod.rs +++ b/src/librustc_data_structures/obligation_forest/mod.rs @@ -269,7 +269,7 @@ impl ObligationForest { let backtrace = self.error_at(index); errors.push(Error { error: error.clone(), - backtrace: backtrace, + backtrace, }); } } @@ -346,7 +346,7 @@ impl ObligationForest { let backtrace = self.error_at(index); errors.push(Error { error: err, - backtrace: backtrace, + backtrace, }); } } @@ -357,8 +357,8 @@ impl ObligationForest { // changed. return Outcome { completed: vec![], - errors: errors, - stalled: stalled, + errors, + stalled, }; } @@ -372,8 +372,8 @@ impl ObligationForest { Outcome { completed: completed_obligations, - errors: errors, - stalled: stalled, + errors, + stalled, } } @@ -638,8 +638,8 @@ impl ObligationForest { impl Node { fn new(parent: Option, obligation: O) -> Node { Node { - obligation: obligation, - parent: parent, + obligation, + parent, state: Cell::new(NodeState::Pending), dependents: vec![], } diff --git a/src/librustc_data_structures/unify/mod.rs b/src/librustc_data_structures/unify/mod.rs index e2d3a4f4537..c9c50e1acb6 100644 --- a/src/librustc_data_structures/unify/mod.rs +++ b/src/librustc_data_structures/unify/mod.rs @@ -87,8 +87,8 @@ impl VarValue { fn new(parent: K, value: K::Value, rank: u32) -> VarValue { VarValue { parent: parent, // this is a root - value: value, - rank: rank, + value, + rank, } } @@ -98,8 +98,8 @@ impl VarValue { fn root(self, rank: u32, value: K::Value) -> VarValue { VarValue { - rank: rank, - value: value, + rank, + value, ..self } } diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 1444dcf4271..8a12aa1f7ae 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -401,8 +401,8 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> { out_dir: &'a Option) -> Self { CompileState { - input: input, - session: session, + input, + session, out_dir: out_dir.as_ref().map(|s| &**s), out_file: None, arena: None, @@ -868,7 +868,7 @@ pub fn phase_2_configure_and_expand(sess: &Session, trait_map: resolver.trait_map, maybe_unused_trait_imports: resolver.maybe_unused_trait_imports, }, - hir_forest: hir_forest, + hir_forest, }) } diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index f8cd2280caf..a726a792767 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -802,7 +802,7 @@ impl RustcDefaultCalls { let mut cfgs = Vec::new(); for &(name, ref value) in sess.parse_sess.config.iter() { let gated_cfg = GatedCfg::gate(&ast::MetaItem { - name: name, + name, node: ast::MetaItemKind::Word, span: DUMMY_SP, }); diff --git a/src/librustc_driver/pretty.rs b/src/librustc_driver/pretty.rs index 84d3ab65b1c..8a61a309250 100644 --- a/src/librustc_driver/pretty.rs +++ b/src/librustc_driver/pretty.rs @@ -174,7 +174,7 @@ impl PpSourceMode { match *self { PpmNormal | PpmEveryBodyLoops | PpmExpanded => { let annotation = NoAnn { - sess: sess, + sess, hir_map: hir_map.map(|m| m.clone()), }; f(&annotation) @@ -182,14 +182,14 @@ impl PpSourceMode { PpmIdentified | PpmExpandedIdentified => { let annotation = IdentifiedAnnotation { - sess: sess, + sess, hir_map: hir_map.map(|m| m.clone()), }; f(&annotation) } PpmExpandedHygiene => { let annotation = HygieneAnnotation { - sess: sess, + sess, }; f(&annotation) } @@ -211,7 +211,7 @@ impl PpSourceMode { match *self { PpmNormal => { let annotation = NoAnn { - sess: sess, + sess, hir_map: Some(hir_map.clone()), }; f(&annotation, hir_map.forest.krate()) @@ -219,7 +219,7 @@ impl PpSourceMode { PpmIdentified => { let annotation = IdentifiedAnnotation { - sess: sess, + sess, hir_map: Some(hir_map.clone()), }; f(&annotation, hir_map.forest.krate()) @@ -235,7 +235,7 @@ impl PpSourceMode { |tcx, _, _, _| { let empty_tables = ty::TypeckTables::empty(None); let annotation = TypedAnnotation { - tcx: tcx, + tcx, tables: Cell::new(&empty_tables) }; let _ignore = tcx.dep_graph.in_ignore(); @@ -680,7 +680,7 @@ impl fold::Folder for ReplaceBodyWithLoop { }) .into_iter() .collect(), - rules: rules, + rules, id: ast::DUMMY_NODE_ID, span: syntax_pos::DUMMY_SP, }) @@ -739,7 +739,7 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, hir_map: &tcx.hir, cfg: &cfg, name: format!("node_{}", code.id()), - labelled_edges: labelled_edges, + labelled_edges, }; match code { @@ -758,7 +758,7 @@ fn print_flowgraph<'a, 'tcx, W: Write>(variants: Vec, let lcfg = borrowck_dot::DataflowLabeller { inner: lcfg, - variants: variants, + variants, borrowck_ctxt: &bccx, analysis_data: &analysis_data, }; diff --git a/src/librustc_errors/diagnostic.rs b/src/librustc_errors/diagnostic.rs index 91d32dbb84f..6c52eabd66d 100644 --- a/src/librustc_errors/diagnostic.rs +++ b/src/librustc_errors/diagnostic.rs @@ -83,9 +83,9 @@ impl Diagnostic { pub fn new_with_code(level: Level, code: Option, message: &str) -> Self { Diagnostic { - level: level, + level, message: vec![(message.to_owned(), Style::NoStyle)], - code: code, + code, span: MultiSpan::new(), children: vec![], suggestions: vec![], @@ -306,10 +306,10 @@ impl Diagnostic { span: MultiSpan, render_span: Option) { let sub = SubDiagnostic { - level: level, + level, message: vec![(message.to_owned(), Style::NoStyle)], - span: span, - render_span: render_span, + span, + render_span, }; self.children.push(sub); } @@ -322,10 +322,10 @@ impl Diagnostic { span: MultiSpan, render_span: Option) { let sub = SubDiagnostic { - level: level, - message: message, - span: span, - render_span: render_span, + level, + message, + span, + render_span, }; self.children.push(sub); } diff --git a/src/librustc_errors/diagnostic_builder.rs b/src/librustc_errors/diagnostic_builder.rs index 5d7c5e2829a..ee0bd949898 100644 --- a/src/librustc_errors/diagnostic_builder.rs +++ b/src/librustc_errors/diagnostic_builder.rs @@ -179,7 +179,7 @@ impl<'a> DiagnosticBuilder<'a> { message: &str) -> DiagnosticBuilder<'a> { DiagnosticBuilder { - handler: handler, + handler, diagnostic: Diagnostic::new_with_code(level, code, message) } } diff --git a/src/librustc_errors/emitter.rs b/src/librustc_errors/emitter.rs index 3cfa635f5b2..22b6a888f25 100644 --- a/src/librustc_errors/emitter.rs +++ b/src/librustc_errors/emitter.rs @@ -120,7 +120,7 @@ impl EmitterWriter { if color_config.use_color() { let dst = Destination::from_stderr(); EmitterWriter { - dst: dst, + dst, cm: code_map, } } else { @@ -156,7 +156,7 @@ impl EmitterWriter { } // We don't have a line yet, create one slot.lines.push(Line { - line_index: line_index, + line_index, annotations: vec![ann], }); slot.lines.sort(); @@ -165,9 +165,9 @@ impl EmitterWriter { } // This is the first time we're seeing the file file_vec.push(FileWithAnnotatedLines { - file: file, + file, lines: vec![Line { - line_index: line_index, + line_index, annotations: vec![ann], }], multiline_depth: 0, diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 159d2c7a2df..3459771459a 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -155,8 +155,8 @@ impl CodeSuggestion { let lo = primary_spans.iter().map(|sp| sp.0.lo).min().unwrap(); let hi = primary_spans.iter().map(|sp| sp.0.hi).min().unwrap(); let bounding_span = Span { - lo: lo, - hi: hi, + lo, + hi, ctxt: NO_EXPANSION, }; let lines = cm.span_to_lines(bounding_span).unwrap(); @@ -292,8 +292,8 @@ impl Handler { Handler { err_count: Cell::new(0), emitter: RefCell::new(e), - can_emit_warnings: can_emit_warnings, - treat_err_as_bug: treat_err_as_bug, + can_emit_warnings, + treat_err_as_bug, continue_after_error: Cell::new(true), delayed_span_bug: RefCell::new(None), } diff --git a/src/librustc_incremental/assert_dep_graph.rs b/src/librustc_incremental/assert_dep_graph.rs index 04192c35ef3..1d58d179960 100644 --- a/src/librustc_incremental/assert_dep_graph.rs +++ b/src/librustc_incremental/assert_dep_graph.rs @@ -76,7 +76,7 @@ pub fn assert_dep_graph<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { // Find annotations supplied by user (if any). let (if_this_changed, then_this_would_need) = { - let mut visitor = IfThisChanged { tcx: tcx, + let mut visitor = IfThisChanged { tcx, if_this_changed: vec![], then_this_would_need: vec![] }; visitor.process_attrs(ast::CRATE_NODE_ID, &tcx.hir.krate().attrs); diff --git a/src/librustc_incremental/persist/dirty_clean.rs b/src/librustc_incremental/persist/dirty_clean.rs index 3f3dc10365c..126057fd043 100644 --- a/src/librustc_incremental/persist/dirty_clean.rs +++ b/src/librustc_incremental/persist/dirty_clean.rs @@ -83,15 +83,15 @@ pub fn check_dirty_clean_annotations<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, debug!("query-nodes: {:?}", query.nodes()); let krate = tcx.hir.krate(); let mut dirty_clean_visitor = DirtyCleanVisitor { - tcx: tcx, + tcx, query: &query, - dirty_inputs: dirty_inputs, + dirty_inputs, checked_attrs: FxHashSet(), }; krate.visit_all_item_likes(&mut dirty_clean_visitor); let mut all_attrs = FindAllAttrs { - tcx: tcx, + tcx, attr_names: vec![ATTR_DIRTY, ATTR_CLEAN], found_attrs: vec![], }; @@ -243,15 +243,15 @@ pub fn check_dirty_clean_metadata<'a, 'tcx>( tcx.dep_graph.with_ignore(||{ let krate = tcx.hir.krate(); let mut dirty_clean_visitor = DirtyCleanMetadataVisitor { - tcx: tcx, - prev_metadata_hashes: prev_metadata_hashes, - current_metadata_hashes: current_metadata_hashes, + tcx, + prev_metadata_hashes, + current_metadata_hashes, checked_attrs: FxHashSet(), }; intravisit::walk_crate(&mut dirty_clean_visitor, krate); let mut all_attrs = FindAllAttrs { - tcx: tcx, + tcx, attr_names: vec![ATTR_DIRTY_METADATA, ATTR_CLEAN_METADATA], found_attrs: vec![], }; diff --git a/src/librustc_incremental/persist/hash.rs b/src/librustc_incremental/persist/hash.rs index 0e8ffb9ee3c..9d762a74bfe 100644 --- a/src/librustc_incremental/persist/hash.rs +++ b/src/librustc_incremental/persist/hash.rs @@ -38,8 +38,8 @@ impl<'a, 'tcx> HashContext<'a, 'tcx> { incremental_hashes_map: &'a IncrementalHashesMap) -> Self { HashContext { - tcx: tcx, - incremental_hashes_map: incremental_hashes_map, + tcx, + incremental_hashes_map, metadata_hashes: FxHashMap(), crate_hashes: FxHashMap(), } diff --git a/src/librustc_incremental/persist/preds/compress/classify/mod.rs b/src/librustc_incremental/persist/preds/compress/classify/mod.rs index 559bdbdd1e2..aa29afd543c 100644 --- a/src/librustc_incremental/persist/preds/compress/classify/mod.rs +++ b/src/librustc_incremental/persist/preds/compress/classify/mod.rs @@ -45,7 +45,7 @@ impl<'a, 'g, N, I, O> Classify<'a, 'g, N, I, O> { pub(super) fn new(r: &'a mut GraphReduce<'g, N, I, O>) -> Self { Classify { - r: r, + r, colors: vec![Color::White; r.in_graph.len_nodes()], stack: vec![], dag: Dag { diff --git a/src/librustc_incremental/persist/preds/mod.rs b/src/librustc_incremental/persist/preds/mod.rs index f7b6b7376d1..5483134523c 100644 --- a/src/librustc_incremental/persist/preds/mod.rs +++ b/src/librustc_incremental/persist/preds/mod.rs @@ -103,8 +103,8 @@ impl<'q> Predecessors<'q> { Predecessors { reduced_graph: graph, - bootstrap_outputs: bootstrap_outputs, - hashes: hashes, + bootstrap_outputs, + hashes, } } } diff --git a/src/librustc_incremental/persist/work_product.rs b/src/librustc_incremental/persist/work_product.rs index 8f99ce91a67..e20d7a006b0 100644 --- a/src/librustc_incremental/persist/work_product.rs +++ b/src/librustc_incremental/persist/work_product.rs @@ -57,7 +57,7 @@ pub fn save_trans_partition(sess: &Session, let work_product = WorkProduct { cgu_name: cgu_name.to_string(), input_hash: partition_hash, - saved_files: saved_files, + saved_files, }; sess.dep_graph.insert_work_product(&work_product_id, work_product); diff --git a/src/librustc_llvm/archive_ro.rs b/src/librustc_llvm/archive_ro.rs index 0b24e55541b..6c3626cd880 100644 --- a/src/librustc_llvm/archive_ro.rs +++ b/src/librustc_llvm/archive_ro.rs @@ -94,7 +94,7 @@ impl<'a> Iterator for Iter<'a> { ::last_error().map(Err) } else { Some(Ok(Child { - ptr: ptr, + ptr, _data: marker::PhantomData, })) } diff --git a/src/librustc_llvm/diagnostic.rs b/src/librustc_llvm/diagnostic.rs index c5276e0c971..c5cdf656692 100644 --- a/src/librustc_llvm/diagnostic.rs +++ b/src/librustc_llvm/diagnostic.rs @@ -82,12 +82,12 @@ impl OptimizationDiagnostic { } OptimizationDiagnostic { - kind: kind, + kind, pass_name: pass_name.expect("got a non-UTF8 pass name from LLVM"), - function: function, - line: line, - column: column, - filename: filename, + function, + line, + column, + filename, message: message.expect("got a non-UTF8 OptimizationDiagnostic message from LLVM") } } diff --git a/src/librustc_metadata/astencode.rs b/src/librustc_metadata/astencode.rs index 6c02ac7eafe..b1b3e92347a 100644 --- a/src/librustc_metadata/astencode.rs +++ b/src/librustc_metadata/astencode.rs @@ -53,7 +53,7 @@ impl<'a, 'b, 'tcx> IsolatedEncoder<'a, 'b, 'tcx> { body: lazy_body, tables: lazy_tables, nested_bodies: lazy_nested_bodies, - rvalue_promotable_to_static: rvalue_promotable_to_static + rvalue_promotable_to_static, }) } } diff --git a/src/librustc_metadata/creader.rs b/src/librustc_metadata/creader.rs index d15843b4f31..4c25d03b441 100644 --- a/src/librustc_metadata/creader.rs +++ b/src/librustc_metadata/creader.rs @@ -162,8 +162,8 @@ enum LoadResult { impl<'a> CrateLoader<'a> { pub fn new(sess: &'a Session, cstore: &'a CStore, local_crate_name: &str) -> Self { CrateLoader { - sess: sess, - cstore: cstore, + sess, + cstore, next_crate_num: cstore.next_crate_num(), local_crate_name: Symbol::intern(local_crate_name), } @@ -184,7 +184,7 @@ impl<'a> CrateLoader<'a> { }; Some(ExternCrateInfo { ident: i.ident.name, - name: name, + name, id: i.id, dep_kind: if attr::contains_name(&i.attrs, "no_link") { DepKind::UnexportedMacrosOnly @@ -325,25 +325,25 @@ impl<'a> CrateLoader<'a> { }); let mut cmeta = cstore::CrateMetadata { - name: name, + name, extern_crate: Cell::new(None), def_path_table: Rc::new(def_path_table), - exported_symbols: exported_symbols, - trait_impls: trait_impls, + exported_symbols, + trait_impls, proc_macros: crate_root.macro_derive_registrar.map(|_| { self.load_derive_macros(&crate_root, dylib.clone().map(|p| p.0), span) }), root: crate_root, blob: metadata, cnum_map: RefCell::new(cnum_map), - cnum: cnum, + cnum, codemap_import_info: RefCell::new(vec![]), attribute_cache: RefCell::new([Vec::new(), Vec::new()]), dep_kind: Cell::new(dep_kind), source: cstore::CrateSource { - dylib: dylib, - rlib: rlib, - rmeta: rmeta, + dylib, + rlib, + rmeta, }, // Initialize this with an empty set. The field is populated below // after we were able to deserialize its contents. @@ -388,14 +388,14 @@ impl<'a> CrateLoader<'a> { info!("falling back to a load"); let mut locate_ctxt = locator::Context { sess: self.sess, - span: span, - ident: ident, + span, + ident, crate_name: name, hash: hash.map(|a| &*a), filesearch: self.sess.target_filesearch(path_kind), target: &self.sess.target.target, triple: &self.sess.opts.target_triple, - root: root, + root, rejected_via_hash: vec![], rejected_via_triple: vec![], rejected_via_kind: vec![], @@ -547,7 +547,7 @@ impl<'a> CrateLoader<'a> { let mut target_only = false; let mut locate_ctxt = locator::Context { sess: self.sess, - span: span, + span, ident: info.ident, crate_name: info.name, hash: None, @@ -596,9 +596,9 @@ impl<'a> CrateLoader<'a> { }; ExtensionCrate { - metadata: metadata, + metadata, dylib: dylib.map(|p| p.0), - target_only: target_only, + target_only, } } @@ -1221,9 +1221,9 @@ impl<'a> CrateLoader<'a> { .collect(); let lib = NativeLibrary { name: n, - kind: kind, - cfg: cfg, - foreign_items: foreign_items, + kind, + cfg, + foreign_items, }; register_native_lib(self.sess, self.cstore, Some(m.span), lib); } diff --git a/src/librustc_metadata/cstore.rs b/src/librustc_metadata/cstore.rs index fb43f91c46d..3419d121088 100644 --- a/src/librustc_metadata/cstore.rs +++ b/src/librustc_metadata/cstore.rs @@ -114,7 +114,7 @@ impl CStore { statically_included_foreign_items: RefCell::new(FxHashSet()), dllimport_foreign_items: RefCell::new(FxHashSet()), visible_parent_map: RefCell::new(FxHashMap()), - metadata_loader: metadata_loader, + metadata_loader, } } diff --git a/src/librustc_metadata/cstore_impl.rs b/src/librustc_metadata/cstore_impl.rs index d2ab9b2fbce..cfba11b5151 100644 --- a/src/librustc_metadata/cstore_impl.rs +++ b/src/librustc_metadata/cstore_impl.rs @@ -282,7 +282,7 @@ impl CrateStore for cstore::CStore { { self.get_crate_data(cnum).root.plugin_registrar_fn.map(|index| DefId { krate: cnum, - index: index + index, }) } @@ -290,7 +290,7 @@ impl CrateStore for cstore::CStore { { self.get_crate_data(cnum).root.macro_derive_registrar.map(|index| DefId { krate: cnum, - index: index + index, }) } diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index ad3a9dd9fef..5c37333fc7e 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -69,7 +69,7 @@ pub trait Metadata<'a, 'tcx>: Copy { opaque: opaque::Decoder::new(self.raw_bytes(), pos), cdata: self.cdata(), sess: self.sess().or(tcx.map(|tcx| tcx.sess)), - tcx: tcx, + tcx, last_filemap_index: 0, lazy_state: LazyState::NoNode, } @@ -468,7 +468,7 @@ impl<'a, 'tcx> CrateMetadata { fn local_def_id(&self, index: DefIndex) -> DefId { DefId { krate: self.cnum, - index: index, + index, } } @@ -703,7 +703,7 @@ impl<'a, 'tcx> CrateMetadata { for child_index in child.children.decode((self, sess)) { if let Some(def) = self.get_def(child_index) { callback(def::Export { - def: def, + def, ident: Ident::with_empty_ctxt(self.item_name(child_index)), span: self.entry(child_index).span.decode((self, sess)), }); @@ -835,8 +835,8 @@ impl<'a, 'tcx> CrateMetadata { }; ty::AssociatedItem { - name: name, - kind: kind, + name, + kind, vis: item.visibility.decode(self), defaultness: container.defaultness(), def_id: self.local_def_id(id), diff --git a/src/librustc_metadata/encoder.rs b/src/librustc_metadata/encoder.rs index 8a753a0ae4b..1dc5d695348 100644 --- a/src/librustc_metadata/encoder.rs +++ b/src/librustc_metadata/encoder.rs @@ -422,16 +422,16 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> { None }, - crate_deps: crate_deps, - dylib_dependency_formats: dylib_dependency_formats, - lang_items: lang_items, - lang_items_missing: lang_items_missing, - native_libraries: native_libraries, - codemap: codemap, - def_path_table: def_path_table, - impls: impls, - exported_symbols: exported_symbols, - index: index, + crate_deps, + dylib_dependency_formats, + lang_items, + lang_items_missing, + native_libraries, + codemap, + def_path_table, + impls, + exported_symbols, + index, }); let total_bytes = self.position(); @@ -719,15 +719,15 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { }; FnData { constness: hir::Constness::NotConst, - arg_names: arg_names, + arg_names, sig: self.lazy(&tcx.fn_sig(def_id)), } } else { bug!() }; EntryKind::Method(self.lazy(&MethodData { - fn_data: fn_data, - container: container, + fn_data, + container, has_self: trait_item.method_has_self_argument, })) } @@ -735,7 +735,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { }; Entry { - kind: kind, + kind, visibility: self.lazy(&trait_item.vis), span: self.lazy(&ast_item.span), attributes: self.encode_attributes(&ast_item.attrs), @@ -805,8 +805,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { bug!() }; EntryKind::Method(self.lazy(&MethodData { - fn_data: fn_data, - container: container, + fn_data, + container, has_self: impl_item.method_has_self_argument, })) } @@ -828,7 +828,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { }; Entry { - kind: kind, + kind, visibility: self.lazy(&impl_item.vis), span: self.lazy(&ast_item.span), attributes: self.encode_attributes(&ast_item.attrs), @@ -915,7 +915,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { } hir::ItemFn(_, _, constness, .., body) => { let data = FnData { - constness: constness, + constness, arg_names: self.encode_fn_arg_names_for_body(body), sig: self.lazy(&tcx.fn_sig(def_id)), }; @@ -946,7 +946,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { EntryKind::Struct(self.lazy(&VariantData { ctor_kind: variant.ctor_kind, discr: variant.discr, - struct_ctor: struct_ctor, + struct_ctor, ctor_sig: None, }), repr_options) } @@ -998,10 +998,10 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { }); let data = ImplData { - polarity: polarity, - defaultness: defaultness, + polarity, + defaultness, parent_impl: parent, - coerce_unsized_info: coerce_unsized_info, + coerce_unsized_info, trait_ref: trait_ref.map(|trait_ref| self.lazy(&trait_ref)), }; @@ -1023,7 +1023,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { }; Entry { - kind: kind, + kind, visibility: self.lazy(&ty::Visibility::from_hir(&item.vis, item.id, tcx)), span: self.lazy(&item.span), attributes: self.encode_attributes(&item.attrs), @@ -1333,7 +1333,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { debug!("IsolatedEncoder::encode_impls()"); let tcx = self.tcx; let mut visitor = ImplVisitor { - tcx: tcx, + tcx, impls: FxHashMap(), }; tcx.hir.krate().visit_all_item_likes(&mut visitor); @@ -1412,7 +1412,7 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { }; Entry { - kind: kind, + kind, visibility: self.lazy(&ty::Visibility::from_hir(&nitem.vis, nitem.id, tcx)), span: self.lazy(&nitem.span), attributes: self.encode_attributes(&nitem.attrs), @@ -1653,14 +1653,14 @@ pub fn encode_metadata<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let (root, metadata_hashes) = { let mut ecx = EncodeContext { opaque: opaque::Encoder::new(&mut cursor), - tcx: tcx, - link_meta: link_meta, - exported_symbols: exported_symbols, + tcx, + link_meta, + exported_symbols, lazy_state: LazyState::NoNode, type_shorthands: Default::default(), predicate_shorthands: Default::default(), metadata_hashes: EncodedMetadataHashes::new(), - compute_ich: compute_ich, + compute_ich, }; // Encode the rustc version string in a predictable location. diff --git a/src/librustc_metadata/index_builder.rs b/src/librustc_metadata/index_builder.rs index 2db9c6a4ff8..1d2b6cc33d4 100644 --- a/src/librustc_metadata/index_builder.rs +++ b/src/librustc_metadata/index_builder.rs @@ -92,7 +92,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { pub fn new(ecx: &'a mut EncodeContext<'b, 'tcx>) -> Self { IndexBuilder { items: Index::new(ecx.tcx.hir.definitions().def_index_counts_lo_hi()), - ecx: ecx, + ecx, } } @@ -137,7 +137,7 @@ impl<'a, 'b, 'tcx> IndexBuilder<'a, 'b, 'tcx> { if let Some(hash) = fingerprint { ecx.metadata_hashes.hashes.push(EncodedMetadataHash { def_index: id.index, - hash: hash, + hash, }); } diff --git a/src/librustc_metadata/isolated_encoder.rs b/src/librustc_metadata/isolated_encoder.rs index c4116489357..b9ad9086c03 100644 --- a/src/librustc_metadata/isolated_encoder.rs +++ b/src/librustc_metadata/isolated_encoder.rs @@ -32,8 +32,8 @@ impl<'a, 'b: 'a, 'tcx: 'b> IsolatedEncoder<'a, 'b, 'tcx> { let tcx = ecx.tcx; let compute_ich = ecx.compute_ich; IsolatedEncoder { - tcx: tcx, - ecx: ecx, + tcx, + ecx, hcx: if compute_ich { // We are always hashing spans for things in metadata because // don't know if a downstream crate will use them or not. diff --git a/src/librustc_metadata/locator.rs b/src/librustc_metadata/locator.rs index 9bcf590eb8b..257af2f2850 100644 --- a/src/librustc_metadata/locator.rs +++ b/src/librustc_metadata/locator.rs @@ -518,9 +518,9 @@ impl<'a> Context<'a> { if let Some((h, m)) = slot { libraries.insert(h, Library { - dylib: dylib, - rlib: rlib, - rmeta: rmeta, + dylib, + rlib, + rmeta, metadata: m, }); } @@ -808,10 +808,10 @@ impl<'a> Context<'a> { match slot { Some((_, metadata)) => { Some(Library { - dylib: dylib, - rlib: rlib, - rmeta: rmeta, - metadata: metadata, + dylib, + rlib, + rmeta, + metadata, }) } None => None, diff --git a/src/librustc_metadata/schema.rs b/src/librustc_metadata/schema.rs index 0b670121ba2..b71f4d0d98c 100644 --- a/src/librustc_metadata/schema.rs +++ b/src/librustc_metadata/schema.rs @@ -84,7 +84,7 @@ pub struct Lazy { impl Lazy { pub fn with_position(position: usize) -> Lazy { Lazy { - position: position, + position, _marker: PhantomData, } } @@ -141,8 +141,8 @@ impl LazySeq { pub fn with_position_and_length(position: usize, len: usize) -> LazySeq { LazySeq { - len: len, - position: position, + len, + position, _marker: PhantomData, } } @@ -199,7 +199,7 @@ pub struct Tracked { impl Tracked { pub fn new(state: T) -> Tracked { Tracked { - state: state, + state, } } diff --git a/src/librustc_mir/build/cfg.rs b/src/librustc_mir/build/cfg.rs index c20f8bde783..b390e2888f2 100644 --- a/src/librustc_mir/build/cfg.rs +++ b/src/librustc_mir/build/cfg.rs @@ -49,7 +49,7 @@ impl<'tcx> CFG<'tcx> { source_info: SourceInfo, extent: CodeExtent) { self.push(block, Statement { - source_info: source_info, + source_info, kind: StatementKind::EndRegion(extent), }); } @@ -60,7 +60,7 @@ impl<'tcx> CFG<'tcx> { lvalue: &Lvalue<'tcx>, rvalue: Rvalue<'tcx>) { self.push(block, Statement { - source_info: source_info, + source_info, kind: StatementKind::Assign(lvalue.clone(), rvalue) }); } @@ -93,8 +93,8 @@ impl<'tcx> CFG<'tcx> { block, self.block_data(block)); self.block_data_mut(block).terminator = Some(Terminator { - source_info: source_info, - kind: kind, + source_info, + kind, }); } } diff --git a/src/librustc_mir/build/expr/as_rvalue.rs b/src/librustc_mir/build/expr/as_rvalue.rs index a625f4b0458..c74378bdadc 100644 --- a/src/librustc_mir/build/expr/as_rvalue.rs +++ b/src/librustc_mir/build/expr/as_rvalue.rs @@ -100,7 +100,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { if let Some(scope) = scope { // schedule a shallow free of that memory, lest we unwind: this.cfg.push(block, Statement { - source_info: source_info, + source_info, kind: StatementKind::StorageLive(result.clone()) }); this.schedule_drop(expr_span, scope, &result, value.ty); diff --git a/src/librustc_mir/build/expr/as_temp.rs b/src/librustc_mir/build/expr/as_temp.rs index 9be306d2848..4f248ddb0e2 100644 --- a/src/librustc_mir/build/expr/as_temp.rs +++ b/src/librustc_mir/build/expr/as_temp.rs @@ -52,7 +52,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { if !expr_ty.is_never() && temp_lifetime.is_some() { this.cfg.push(block, Statement { - source_info: source_info, + source_info, kind: StatementKind::StorageLive(temp.clone()) }); } diff --git a/src/librustc_mir/build/expr/into.rs b/src/librustc_mir/build/expr/into.rs index 7ae5d6b0ec1..576b1059e59 100644 --- a/src/librustc_mir/build/expr/into.rs +++ b/src/librustc_mir/build/expr/into.rs @@ -240,8 +240,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let cleanup = this.diverge_cleanup(); this.cfg.terminate(block, source_info, TerminatorKind::Call { func: fun, - args: args, - cleanup: cleanup, + args, + cleanup, destination: if diverges { None } else { diff --git a/src/librustc_mir/build/expr/stmt.rs b/src/librustc_mir/build/expr/stmt.rs index 3120ac21908..0da722f72a1 100644 --- a/src/librustc_mir/build/expr/stmt.rs +++ b/src/librustc_mir/build/expr/stmt.rs @@ -127,11 +127,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { unpack!(block = this.as_local_operand(block, input)) }).collect(); this.cfg.push(block, Statement { - source_info: source_info, + source_info, kind: StatementKind::InlineAsm { asm: box asm.clone(), - outputs: outputs, - inputs: inputs + outputs, + inputs, }, }); block.unit() diff --git a/src/librustc_mir/build/matches/mod.rs b/src/librustc_mir/build/matches/mod.rs index c0b54ce2a84..78805ba87ec 100644 --- a/src/librustc_mir/build/matches/mod.rs +++ b/src/librustc_mir/build/matches/mod.rs @@ -69,8 +69,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { span: pattern.span, match_pairs: vec![MatchPair::new(discriminant_lvalue.clone(), pattern)], bindings: vec![], - guard: guard, - arm_index: arm_index, + guard, + arm_index, } }) .collect(); @@ -179,7 +179,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { var_scope = Some(this.new_visibility_scope(scope_span)); } let source_info = SourceInfo { - span: span, + span, scope: var_scope.unwrap() }; this.declare_binding(source_info, mutability, name, var, ty); @@ -193,7 +193,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let local_id = self.var_indices[&var]; let source_info = self.source_info(span); self.cfg.push(block, Statement { - source_info: source_info, + source_info, kind: StatementKind::StorageLive(Lvalue::Local(local_id)) }); Lvalue::Local(local_id) @@ -708,10 +708,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { var_id, name, var_ty, source_info); let var = self.local_decls.push(LocalDecl::<'tcx> { - mutability: mutability, + mutability, ty: var_ty.clone(), name: Some(name), - source_info: source_info, + source_info, is_user_variable: true, }); self.var_indices.insert(var_id, var); diff --git a/src/librustc_mir/build/matches/simplify.rs b/src/librustc_mir/build/matches/simplify.rs index efddee2c933..6e3eef57352 100644 --- a/src/librustc_mir/build/matches/simplify.rs +++ b/src/librustc_mir/build/matches/simplify.rs @@ -71,8 +71,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { PatternKind::Binding { name, mutability, mode, var, ty, ref subpattern } => { candidate.bindings.push(Binding { - name: name, - mutability: mutability, + name, + mutability, span: match_pair.pattern.span, source: match_pair.lvalue.clone(), var_id: var, diff --git a/src/librustc_mir/build/matches/test.rs b/src/librustc_mir/build/matches/test.rs index 28386fa598c..dc15163ecc1 100644 --- a/src/librustc_mir/build/matches/test.rs +++ b/src/librustc_mir/build/matches/test.rs @@ -218,7 +218,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { discr: Operand::Consume(discr), switch_ty: discr_ty, values: From::from(values), - targets: targets + targets, }); target_blocks } @@ -249,9 +249,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { ).collect(); (targets.clone(), TerminatorKind::SwitchInt { discr: Operand::Consume(lvalue.clone()), - switch_ty: switch_ty, + switch_ty, values: From::from(values), - targets: targets, + targets, }) }; self.cfg.terminate(block, source_info, terminator); @@ -315,7 +315,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { }), args: vec![val, expect], destination: Some((eq_result.clone(), eq_block)), - cleanup: cleanup, + cleanup, }); // check the result diff --git a/src/librustc_mir/build/matches/util.rs b/src/librustc_mir/build/matches/util.rs index a013875b311..3e303865ac4 100644 --- a/src/librustc_mir/build/matches/util.rs +++ b/src/librustc_mir/build/matches/util.rs @@ -44,7 +44,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { .map(|(idx, subpattern)| { let elem = ProjectionElem::ConstantIndex { offset: idx as u32, - min_length: min_length, + min_length, from_end: false, }; let lvalue = lvalue.clone().elem(elem); @@ -67,7 +67,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { .map(|(idx, subpattern)| { let elem = ProjectionElem::ConstantIndex { offset: (idx+1) as u32, - min_length: min_length, + min_length, from_end: true, }; let lvalue = lvalue.clone().elem(elem); @@ -80,8 +80,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { impl<'pat, 'tcx> MatchPair<'pat, 'tcx> { pub fn new(lvalue: Lvalue<'tcx>, pattern: &'pat Pattern<'tcx>) -> MatchPair<'pat, 'tcx> { MatchPair { - lvalue: lvalue, - pattern: pattern, + lvalue, + pattern, slice_len_checked: false, } } diff --git a/src/librustc_mir/build/misc.rs b/src/librustc_mir/build/misc.rs index 6c93e073de6..0e4aac42991 100644 --- a/src/librustc_mir/build/misc.rs +++ b/src/librustc_mir/build/misc.rs @@ -41,9 +41,9 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { literal: Literal<'tcx>) -> Operand<'tcx> { let constant = box Constant { - span: span, - ty: ty, - literal: literal, + span, + ty, + literal, }; Operand::Constant(constant) } diff --git a/src/librustc_mir/build/mod.rs b/src/librustc_mir/build/mod.rs index 14392ae70e4..0c7a78c980a 100644 --- a/src/librustc_mir/build/mod.rs +++ b/src/librustc_mir/build/mod.rs @@ -121,7 +121,7 @@ pub fn mir_build<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Mir<'t // Convert the Mir to global types. let mut globalizer = GlobalizeMir { - tcx: tcx, + tcx, span: mir.span }; globalizer.visit_mir(&mut mir); @@ -179,7 +179,7 @@ fn create_constructor_shim<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Convert the Mir to global types. let tcx = infcx.tcx.global_tcx(); let mut globalizer = GlobalizeMir { - tcx: tcx, + tcx, span: mir.span }; globalizer.visit_mir(&mut mir); @@ -380,7 +380,7 @@ fn construct_fn<'a, 'gcx, 'tcx, A>(hir: Cx<'a, 'gcx, 'tcx>, }; let mut decl = UpvarDecl { debug_name: keywords::Invalid.name(), - by_ref: by_ref + by_ref, }; if let Some(hir::map::NodeLocal(pat)) = tcx.hir.find(var_node_id) { if let hir::PatKind::Binding(_, _, ref ident, _) = pat.node { @@ -437,10 +437,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { return_ty: Ty<'tcx>) -> Builder<'a, 'gcx, 'tcx> { let mut builder = Builder { - hir: hir, + hir, cfg: CFG { basic_blocks: IndexVec::new() }, fn_span: span, - arg_count: arg_count, + arg_count, scopes: vec![], visibility_scopes: IndexVec::new(), visibility_scope: ARGUMENT_VISIBILITY_SCOPE, @@ -500,12 +500,12 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { self.local_decls.push(LocalDecl { mutability: Mutability::Not, - ty: ty, + ty, source_info: SourceInfo { scope: ARGUMENT_VISIBILITY_SCOPE, span: pattern.map_or(self.fn_span, |pat| pat.span) }, - name: name, + name, is_user_variable: false, }); } diff --git a/src/librustc_mir/build/scope.rs b/src/librustc_mir/build/scope.rs index ce64f88d18e..d22969d5a1b 100644 --- a/src/librustc_mir/build/scope.rs +++ b/src/librustc_mir/build/scope.rs @@ -213,7 +213,7 @@ impl<'tcx> Scope<'tcx> { /// Given a span and this scope's visibility scope, make a SourceInfo. fn source_info(&self, span: Span) -> SourceInfo { SourceInfo { - span: span, + span, scope: self.visibility_scope } } @@ -235,10 +235,10 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { { let extent = self.topmost_scope(); let scope = BreakableScope { - extent: extent, + extent, continue_block: loop_block, - break_block: break_block, - break_destination: break_destination, + break_block, + break_destination, }; self.breakable_scopes.push(scope); let res = f(self); @@ -386,7 +386,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let parent = self.visibility_scope; let scope = VisibilityScope::new(self.visibility_scopes.len()); self.visibility_scopes.push(VisibilityScopeData { - span: span, + span, parent_scope: Some(parent), }); scope @@ -411,7 +411,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { /// Given a span and the current visibility scope, make a SourceInfo. pub fn source_info(&self, span: Span) -> SourceInfo { SourceInfo { - span: span, + span, scope: self.visibility_scope } } @@ -619,7 +619,7 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let diverge_target = self.diverge_cleanup(); self.cfg.terminate(block, source_info, TerminatorKind::Drop { - location: location, + location, target: next_target, unwind: diverge_target, }); @@ -637,8 +637,8 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { let diverge_target = self.diverge_cleanup(); self.cfg.terminate(block, source_info, TerminatorKind::DropAndReplace { - location: location, - value: value, + location, + value, target: next_target, unwind: diverge_target, }); @@ -661,11 +661,11 @@ impl<'a, 'gcx, 'tcx> Builder<'a, 'gcx, 'tcx> { self.cfg.terminate(block, source_info, TerminatorKind::Assert { - cond: cond, - expected: expected, - msg: msg, + cond, + expected, + msg, target: success_block, - cleanup: cleanup + cleanup, }); success_block @@ -716,7 +716,7 @@ fn build_scope_drops<'tcx>(cfg: &mut CFG<'tcx>, match drop_data.location { Lvalue::Local(index) if index.index() > arg_count => { cfg.push(block, Statement { - source_info: source_info, + source_info, kind: StatementKind::StorageDead(drop_data.location.clone()) }); } @@ -748,7 +748,7 @@ fn build_diverge_scope<'a, 'gcx, 'tcx>(_tcx: TyCtxt<'a, 'gcx, 'tcx>, let visibility_scope = scope.visibility_scope; let source_info = |span| SourceInfo { - span: span, + span, scope: visibility_scope }; @@ -776,7 +776,7 @@ fn build_diverge_scope<'a, 'gcx, 'tcx>(_tcx: TyCtxt<'a, 'gcx, 'tcx>, cfg.terminate(block, source_info(drop_data.span), TerminatorKind::Drop { location: drop_data.location.clone(), - target: target, + target, unwind: None }); *cached_block = Some(block); diff --git a/src/librustc_mir/dataflow/drop_flag_effects.rs b/src/librustc_mir/dataflow/drop_flag_effects.rs index 890fe3c091a..a7894f02499 100644 --- a/src/librustc_mir/dataflow/drop_flag_effects.rs +++ b/src/librustc_mir/dataflow/drop_flag_effects.rs @@ -76,9 +76,9 @@ pub(crate) fn do_dataflow<'a, 'tcx, BD, P>(tcx: TyCtxt<'a, 'tcx, 'tcx>, name_found(tcx.sess, attributes, "borrowck_graphviz_postflow"); let mut mbcx = DataflowBuilder { - node_id: node_id, - print_preflow_to: print_preflow_to, - print_postflow_to: print_postflow_to, + node_id, + print_preflow_to, + print_postflow_to, flow_state: DataflowAnalysis::new(tcx, mir, dead_unwinds, bd), }; diff --git a/src/librustc_mir/dataflow/mod.rs b/src/librustc_mir/dataflow/mod.rs index 7c0137b18c0..ea855ee4d3e 100644 --- a/src/librustc_mir/dataflow/mod.rs +++ b/src/librustc_mir/dataflow/mod.rs @@ -410,12 +410,12 @@ impl<'a, 'tcx: 'a, D> DataflowAnalysis<'a, 'tcx, D> }); DataflowAnalysis { - mir: mir, - dead_unwinds: dead_unwinds, + mir, + dead_unwinds, flow_state: DataflowState { sets: AllSets { - bits_per_block: bits_per_block, - words_per_block: words_per_block, + bits_per_block, + words_per_block, gen_sets: zeroes.clone(), kill_sets: zeroes, on_entry_sets: on_entry, diff --git a/src/librustc_mir/dataflow/move_paths/abs_domain.rs b/src/librustc_mir/dataflow/move_paths/abs_domain.rs index 1255209322b..173396f2245 100644 --- a/src/librustc_mir/dataflow/move_paths/abs_domain.rs +++ b/src/librustc_mir/dataflow/move_paths/abs_domain.rs @@ -58,9 +58,9 @@ impl<'tcx> Lift for LvalueElem<'tcx> { ProjectionElem::Subslice { from: from, to: to }, ProjectionElem::ConstantIndex {offset,min_length,from_end} => ProjectionElem::ConstantIndex { - offset: offset, - min_length: min_length, - from_end: from_end + offset, + min_length, + from_end, }, ProjectionElem::Downcast(a, u) => ProjectionElem::Downcast(a.clone(), u.clone()), diff --git a/src/librustc_mir/dataflow/move_paths/mod.rs b/src/librustc_mir/dataflow/move_paths/mod.rs index 20a61418d85..eff6883f170 100644 --- a/src/librustc_mir/dataflow/move_paths/mod.rs +++ b/src/librustc_mir/dataflow/move_paths/mod.rs @@ -212,9 +212,9 @@ impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> { let mut path_map = IndexVec::new(); MoveDataBuilder { - mir: mir, - tcx: tcx, - param_env: param_env, + mir, + tcx, + param_env, data: MoveData { moves: IndexVec::new(), loc_map: LocationMap::new(mir), @@ -224,8 +224,8 @@ impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> { }).collect(), projections: FxHashMap(), }, - move_paths: move_paths, - path_map: path_map, + move_paths, + path_map, } } } @@ -239,8 +239,8 @@ impl<'a, 'tcx> MoveDataBuilder<'a, 'tcx> { let move_path = move_paths.push(MovePath { next_sibling: None, first_child: None, - parent: parent, - lvalue: lvalue + parent, + lvalue, }); if let Some(parent) = parent { diff --git a/src/librustc_mir/hair/cx/block.rs b/src/librustc_mir/hair/cx/block.rs index fa54925c6e7..0324552cd56 100644 --- a/src/librustc_mir/hair/cx/block.rs +++ b/src/librustc_mir/hair/cx/block.rs @@ -29,9 +29,9 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Block { Block { targeted_by_break: self.targeted_by_break, extent: CodeExtent::Misc(self.id), - opt_destruction_extent: opt_destruction_extent, + opt_destruction_extent, span: self.span, - stmts: stmts, + stmts, expr: self.expr.to_ref(), } } @@ -79,7 +79,7 @@ fn mirror_stmts<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, kind: StmtKind::Let { remainder_scope: remainder_extent, init_scope: CodeExtent::Misc(id), - pattern: pattern, + pattern, initializer: local.init.to_ref(), }, opt_destruction_extent: opt_dxn_ext, @@ -99,7 +99,7 @@ pub fn to_expr_ref<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let temp_lifetime = cx.region_maps.temporary_scope(block.id); let expr = Expr { ty: block_ty, - temp_lifetime: temp_lifetime, + temp_lifetime, span: block.span, kind: ExprKind::Block { body: block }, }; diff --git a/src/librustc_mir/hair/cx/expr.rs b/src/librustc_mir/hair/cx/expr.rs index 617c3c77bbb..944fb8e8332 100644 --- a/src/librustc_mir/hair/cx/expr.rs +++ b/src/librustc_mir/hair/cx/expr.rs @@ -42,7 +42,7 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr { // Next, wrap this up in the expr's scope. expr = Expr { - temp_lifetime: temp_lifetime, + temp_lifetime, ty: expr.ty, span: self.span, kind: ExprKind::Scope { @@ -54,11 +54,11 @@ impl<'tcx> Mirror<'tcx> for &'tcx hir::Expr { // Finally, create a destruction scope, if any. if let Some(extent) = cx.region_maps.opt_destruction_extent(self.id) { expr = Expr { - temp_lifetime: temp_lifetime, + temp_lifetime, ty: expr.ty, span: self.span, kind: ExprKind::Scope { - extent: extent, + extent, value: expr.to_ref(), }, }; @@ -136,7 +136,7 @@ fn apply_adjustment<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }), span, kind: ExprKind::Borrow { - region: region, + region, borrow_kind: to_borrow_kind(m), arg: expr.to_ref(), }, @@ -173,7 +173,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ExprKind::Call { ty: expr.ty, fun: expr.to_ref(), - args: args, + args, } } @@ -191,7 +191,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let arg_tys = args.iter().map(|e| cx.tables().expr_ty_adjusted(e)); let tupled_args = Expr { ty: cx.tcx.mk_tup(arg_tys, false), - temp_lifetime: temp_lifetime, + temp_lifetime, span: expr.span, kind: ExprKind::Tuple { fields: args.iter().map(ToRef::to_ref).collect() }, }; @@ -228,8 +228,8 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }) .collect(); ExprKind::Adt { - adt_def: adt_def, - substs: substs, + adt_def, + substs, variant_index: index, fields: field_refs, base: None, @@ -250,7 +250,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, _ => span_bug!(expr.span, "type of & not region"), }; ExprKind::Borrow { - region: region, + region, borrow_kind: to_borrow_kind(mutbl), arg: expr.to_ref(), } @@ -320,7 +320,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, _ => { let op = bin_op(op.node); ExprKind::Binary { - op: op, + op, lhs: lhs.to_ref(), rhs: rhs.to_ref(), } @@ -384,7 +384,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ExprKind::Adt { adt_def: adt, variant_index: 0, - substs: substs, + substs, fields: field_refs, base: base.as_ref().map(|base| { FruInfo { @@ -410,7 +410,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ExprKind::Adt { adt_def: adt, variant_index: index, - substs: substs, + substs, fields: field_refs, base: None, } @@ -446,8 +446,8 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }); ExprKind::Closure { closure_id: def_id, - substs: substs, - upvars: upvars, + substs, + upvars, } } @@ -458,7 +458,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, hir::ExprInlineAsm(ref asm, ref outputs, ref inputs) => { ExprKind::InlineAsm { - asm: asm, + asm, outputs: outputs.to_ref(), inputs: inputs.to_ref(), } @@ -477,7 +477,7 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ExprKind::Repeat { value: v.to_ref(), - count: count, + count, } } hir::ExprRet(ref v) => ExprKind::Return { value: v.to_ref() }, @@ -570,10 +570,10 @@ fn make_mirror_unadjusted<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }; Expr { - temp_lifetime: temp_lifetime, + temp_lifetime, ty: expr_ty, span: expr.span, - kind: kind, + kind, } } @@ -587,7 +587,7 @@ fn method_callee<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, cx.tables().node_substs(expr.hir_id)) }); Expr { - temp_lifetime: temp_lifetime, + temp_lifetime, ty: cx.tcx().mk_fn_def(def_id, substs), span: expr.span, kind: ExprKind::Literal { @@ -637,8 +637,8 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, Def::Const(def_id) | Def::AssociatedConst(def_id) => ExprKind::Literal { literal: Literal::Item { - def_id: def_id, - substs: substs, + def_id, + substs, }, }, @@ -649,9 +649,9 @@ fn convert_path_expr<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, // We return a completely different ExprKind here to account for this special case. ty::TyAdt(adt_def, substs) => { ExprKind::Adt { - adt_def: adt_def, + adt_def, variant_index: adt_def.variant_index_with_id(def_id), - substs: substs, + substs, fields: vec![], base: None, } @@ -712,12 +712,12 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }); Expr { ty: closure_ty, - temp_lifetime: temp_lifetime, + temp_lifetime, span: expr.span, kind: ExprKind::Deref { arg: Expr { ty: ref_closure_ty, - temp_lifetime: temp_lifetime, + temp_lifetime, span: expr.span, kind: ExprKind::SelfRef, } @@ -733,12 +733,12 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, }); Expr { ty: closure_ty, - temp_lifetime: temp_lifetime, + temp_lifetime, span: expr.span, kind: ExprKind::Deref { arg: Expr { ty: ref_closure_ty, - temp_lifetime: temp_lifetime, + temp_lifetime, span: expr.span, kind: ExprKind::SelfRef, }.to_ref(), @@ -748,7 +748,7 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ty::ClosureKind::FnOnce => { Expr { ty: closure_ty, - temp_lifetime: temp_lifetime, + temp_lifetime, span: expr.span, kind: ExprKind::SelfRef, } @@ -772,7 +772,7 @@ fn convert_var<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ty::UpvarCapture::ByRef(borrow) => { ExprKind::Deref { arg: Expr { - temp_lifetime: temp_lifetime, + temp_lifetime, ty: cx.tcx.mk_ref(borrow.region, ty::TypeAndMut { ty: var_ty, @@ -857,7 +857,7 @@ fn overloaded_lvalue<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let temp_lifetime = cx.region_maps.temporary_scope(expr.id); let fun = method_callee(cx, expr, custom_callee); let ref_expr = Expr { - temp_lifetime: temp_lifetime, + temp_lifetime, ty: ref_ty, span: expr.span, kind: ExprKind::Call { @@ -887,7 +887,7 @@ fn capture_freevar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, let var_ty = cx.tables() .node_id_to_type(cx.tcx.hir.node_to_hir_id(var_node_id)); let captured_var = Expr { - temp_lifetime: temp_lifetime, + temp_lifetime, ty: var_ty, span: closure_expr.span, kind: convert_var(cx, closure_expr, freevar.def), @@ -901,12 +901,12 @@ fn capture_freevar<'a, 'gcx, 'tcx>(cx: &mut Cx<'a, 'gcx, 'tcx>, ty::BorrowKind::MutBorrow => BorrowKind::Mut, }; Expr { - temp_lifetime: temp_lifetime, + temp_lifetime, ty: freevar_ty, span: closure_expr.span, kind: ExprKind::Borrow { region: upvar_borrow.region, - borrow_kind: borrow_kind, + borrow_kind, arg: captured_var.to_ref(), }, }.to_ref() diff --git a/src/librustc_mir/shim.rs b/src/librustc_mir/shim.rs index 62e762be93a..6b4a8a2dcb7 100644 --- a/src/librustc_mir/shim.rs +++ b/src/librustc_mir/shim.rs @@ -303,7 +303,7 @@ fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, span )); statements.push(Statement { - source_info: source_info, + source_info, kind: StatementKind::Assign( Lvalue::Local(ref_rcvr), Rvalue::Ref(tcx.types.re_erased, BorrowKind::Mut, rcvr_l) @@ -317,7 +317,7 @@ fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, CallKind::Indirect => (rcvr, vec![]), CallKind::Direct(def_id) => ( Operand::Constant(box Constant { - span: span, + span, ty: tcx.type_of(def_id), literal: Literal::Value { value: ConstVal::Function(def_id, @@ -351,7 +351,7 @@ fn build_call_shim<'a, 'tcx>(tcx: ty::TyCtxt<'a, 'tcx, 'tcx>, // BB #0 block(&mut blocks, statements, TerminatorKind::Call { func: callee, - args: args, + args, destination: Some((Lvalue::Local(RETURN_POINTER), BasicBlock::new(1))), cleanup: if let Adjustment::RefMut = rcvr_adjustment { @@ -423,7 +423,7 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, let local_decls = local_decls_for_sig(&sig, span); let source_info = SourceInfo { - span: span, + span, scope: ARGUMENT_VISIBILITY_SCOPE }; @@ -436,7 +436,7 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, // return = ADT(arg0, arg1, ...); return let start_block = BasicBlockData { statements: vec![Statement { - source_info: source_info, + source_info, kind: StatementKind::Assign( Lvalue::Local(RETURN_POINTER), Rvalue::Aggregate( @@ -448,7 +448,7 @@ pub fn build_adt_ctor<'a, 'gcx, 'tcx>(infcx: &infer::InferCtxt<'a, 'gcx, 'tcx>, ) }], terminator: Some(Terminator { - source_info: source_info, + source_info, kind: TerminatorKind::Return, }), is_cleanup: false diff --git a/src/librustc_mir/transform/add_call_guards.rs b/src/librustc_mir/transform/add_call_guards.rs index 23a9c4c57ca..3f14a6be8b2 100644 --- a/src/librustc_mir/transform/add_call_guards.rs +++ b/src/librustc_mir/transform/add_call_guards.rs @@ -75,7 +75,7 @@ impl AddCallGuards { statements: vec![], is_cleanup: block.is_cleanup, terminator: Some(Terminator { - source_info: source_info, + source_info, kind: TerminatorKind::Goto { target: *destination } }) }; diff --git a/src/librustc_mir/transform/copy_prop.rs b/src/librustc_mir/transform/copy_prop.rs index dec0717e9e3..59b81f7e77c 100644 --- a/src/librustc_mir/transform/copy_prop.rs +++ b/src/librustc_mir/transform/copy_prop.rs @@ -299,8 +299,8 @@ impl<'tcx> ConstantPropagationVisitor<'tcx> { fn new(dest_local: Local, constant: Constant<'tcx>) -> ConstantPropagationVisitor<'tcx> { ConstantPropagationVisitor { - dest_local: dest_local, - constant: constant, + dest_local, + constant, uses_replaced: 0, } } diff --git a/src/librustc_mir/transform/elaborate_drops.rs b/src/librustc_mir/transform/elaborate_drops.rs index b158cb43ce7..97391452e59 100644 --- a/src/librustc_mir/transform/elaborate_drops.rs +++ b/src/librustc_mir/transform/elaborate_drops.rs @@ -50,8 +50,8 @@ impl MirPass for ElaborateDrops { let elaborate_patch = { let mir = &*mir; let env = MoveDataParamEnv { - move_data: move_data, - param_env: param_env + move_data, + param_env, }; let dead_unwinds = find_dead_unwinds(tcx, mir, id, &env); let flow_inits = @@ -64,11 +64,11 @@ impl MirPass for ElaborateDrops { |bd, p| &bd.move_data().move_paths[p]); ElaborateDropsCtxt { - tcx: tcx, - mir: mir, + tcx, + mir, env: &env, - flow_inits: flow_inits, - flow_uninits: flow_uninits, + flow_inits, + flow_uninits, drop_flags: FxHashMap(), patch: MirPatch::new(mir), }.elaborate() @@ -510,7 +510,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { debug!("elaborate_drop_and_replace({:?}) - untracked {:?}", terminator, parent); self.patch.patch_terminator(bb, TerminatorKind::Drop { location: location.clone(), - target: target, + target, unwind: Some(unwind) }); } @@ -519,7 +519,7 @@ impl<'b, 'tcx> ElaborateDropsCtxt<'b, 'tcx> { fn constant_bool(&self, span: Span, val: bool) -> Rvalue<'tcx> { Rvalue::Use(Operand::Constant(Box::new(Constant { - span: span, + span, ty: self.tcx.types.bool, literal: Literal::Value { value: ConstVal::Bool(val) } }))) diff --git a/src/librustc_mir/transform/erase_regions.rs b/src/librustc_mir/transform/erase_regions.rs index 89de847231c..fa51cd91be1 100644 --- a/src/librustc_mir/transform/erase_regions.rs +++ b/src/librustc_mir/transform/erase_regions.rs @@ -28,7 +28,7 @@ struct EraseRegionsVisitor<'a, 'tcx: 'a> { impl<'a, 'tcx> EraseRegionsVisitor<'a, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>) -> Self { EraseRegionsVisitor { - tcx: tcx, + tcx, in_validation_statement: false, } } diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs index d3fee8045e6..28aedc8d674 100644 --- a/src/librustc_mir/transform/inline.rs +++ b/src/librustc_mir/transform/inline.rs @@ -90,8 +90,8 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { if let ty::TyFnDef(callee_def_id, substs) = f.ty.sty { callsites.push_back(CallSite { callee: callee_def_id, - substs: substs, - bb: bb, + substs, + bb, location: terminator.source_info }); } @@ -136,8 +136,8 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { if callsite.callee != callee_def_id { callsites.push_back(CallSite { callee: callee_def_id, - substs: substs, - bb: bb, + substs, + bb, location: terminator.source_info }); } @@ -433,12 +433,12 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { let mut integrator = Integrator { block_idx: bb_len, args: &args, - local_map: local_map, - scope_map: scope_map, - promoted_map: promoted_map, + local_map, + scope_map, + promoted_map, _callsite: callsite, destination: dest, - return_block: return_block, + return_block, cleanup_block: cleanup, in_cleanup_block: false }; @@ -461,7 +461,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> { kind => { caller_mir[callsite.bb].terminator = Some(Terminator { source_info: terminator.source_info, - kind: kind + kind, }); false } diff --git a/src/librustc_mir/transform/instcombine.rs b/src/librustc_mir/transform/instcombine.rs index 88a368077d4..6ccc886577a 100644 --- a/src/librustc_mir/transform/instcombine.rs +++ b/src/librustc_mir/transform/instcombine.rs @@ -76,8 +76,8 @@ struct OptimizationFinder<'b, 'a, 'tcx:'a+'b> { impl<'b, 'a, 'tcx:'b> OptimizationFinder<'b, 'a, 'tcx> { fn new(mir: &'b Mir<'tcx>, tcx: TyCtxt<'a, 'tcx, 'tcx>) -> OptimizationFinder<'b, 'a, 'tcx> { OptimizationFinder { - mir: mir, - tcx: tcx, + mir, + tcx, optimizations: OptimizationList::default(), } } diff --git a/src/librustc_mir/transform/mod.rs b/src/librustc_mir/transform/mod.rs index a247ce2231e..e3e4265a7db 100644 --- a/src/librustc_mir/transform/mod.rs +++ b/src/librustc_mir/transform/mod.rs @@ -93,7 +93,7 @@ fn mir_keys<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, krate: CrateNum) } } tcx.hir.krate().visit_all_item_likes(&mut GatherCtors { - tcx: tcx, + tcx, set: &mut set, }.as_deep_visitor()); diff --git a/src/librustc_mir/transform/nll.rs b/src/librustc_mir/transform/nll.rs index fb4764c4962..bd02788df16 100644 --- a/src/librustc_mir/transform/nll.rs +++ b/src/librustc_mir/transform/nll.rs @@ -27,7 +27,7 @@ struct NLLVisitor<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> { impl<'a, 'gcx, 'tcx> NLLVisitor<'a, 'gcx, 'tcx> { pub fn new(infcx: InferCtxt<'a, 'gcx, 'tcx>) -> Self { NLLVisitor { - infcx: infcx, + infcx, lookup_map: HashMap::new(), } } diff --git a/src/librustc_mir/transform/promote_consts.rs b/src/librustc_mir/transform/promote_consts.rs index e1c4602b045..1665cb2f15e 100644 --- a/src/librustc_mir/transform/promote_consts.rs +++ b/src/librustc_mir/transform/promote_consts.rs @@ -107,7 +107,7 @@ impl<'tcx> Visitor<'tcx> for TempCollector<'tcx> { LvalueContext::Store | LvalueContext::Call => { *temp = TempState::Defined { - location: location, + location, uses: 0 }; return; @@ -140,7 +140,7 @@ pub fn collect_temps(mir: &Mir, rpo: &mut ReversePostorder) -> IndexVec Promoter<'a, 'tcx> { statements: vec![], terminator: Some(Terminator { source_info: SourceInfo { - span: span, + span, scope: ARGUMENT_VISIBILITY_SCOPE }, kind: TerminatorKind::Return @@ -179,7 +179,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { let data = &mut self.promoted[last]; data.statements.push(Statement { source_info: SourceInfo { - span: span, + span, scope: ARGUMENT_VISIBILITY_SCOPE }, kind: StatementKind::Assign(Lvalue::Local(dest), rvalue) @@ -251,7 +251,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { Terminator { source_info: terminator.source_info, kind: mem::replace(&mut terminator.kind, TerminatorKind::Goto { - target: target + target, }) } }; @@ -268,8 +268,8 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { *self.promoted[last].terminator_mut() = Terminator { kind: TerminatorKind::Call { - func: func, - args: args, + func, + args, cleanup: None, destination: Some((Lvalue::Local(new_temp), new_target)) }, @@ -289,7 +289,7 @@ impl<'a, 'tcx> Promoter<'a, 'tcx> { fn promote_candidate(mut self, candidate: Candidate) { let span = self.promoted.span; let new_operand = Operand::Constant(box Constant { - span: span, + span, ty: self.promoted.return_ty, literal: Literal::Promoted { index: Promoted::new(self.source.promoted.len()) @@ -387,7 +387,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, promoted: Mir::new( IndexVec::new(), Some(VisibilityScopeData { - span: span, + span, parent_scope: None }).into_iter().collect(), IndexVec::new(), @@ -423,7 +423,7 @@ pub fn promote_candidates<'a, 'tcx>(mir: &mut Mir<'tcx>, TerminatorKind::Drop { location: Lvalue::Local(index), target, .. } => { if promoted(index) { terminator.kind = TerminatorKind::Goto { - target: target + target, }; } } diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs index 2ecffdf9fdf..ee99bb7d9d5 100644 --- a/src/librustc_mir/transform/qualify_consts.rs +++ b/src/librustc_mir/transform/qualify_consts.rs @@ -135,13 +135,13 @@ impl<'a, 'tcx> Qualifier<'a, 'tcx, 'tcx> { let temps = promote_consts::collect_temps(mir, &mut rpo); rpo.reset(); Qualifier { - mode: mode, + mode, span: mir.span, - def_id: def_id, - mir: mir, - rpo: rpo, - tcx: tcx, - param_env: param_env, + def_id, + mir, + rpo, + tcx, + param_env, temp_qualif: IndexVec::from_elem(None, &mir.local_decls), return_qualif: None, qualif: Qualif::empty(), diff --git a/src/librustc_mir/transform/simplify.rs b/src/librustc_mir/transform/simplify.rs index a1d56ccd874..070250cda4d 100644 --- a/src/librustc_mir/transform/simplify.rs +++ b/src/librustc_mir/transform/simplify.rs @@ -99,8 +99,8 @@ impl<'a, 'tcx: 'a> CfgSimplifier<'a, 'tcx> { let basic_blocks = mir.basic_blocks_mut(); CfgSimplifier { - basic_blocks: basic_blocks, - pred_count: pred_count + basic_blocks, + pred_count, } } diff --git a/src/librustc_mir/transform/type_check.rs b/src/librustc_mir/transform/type_check.rs index f3a82b54063..4d81c016bd0 100644 --- a/src/librustc_mir/transform/type_check.rs +++ b/src/librustc_mir/transform/type_check.rs @@ -108,8 +108,8 @@ impl<'a, 'b, 'gcx, 'tcx> Visitor<'tcx> for TypeVerifier<'a, 'b, 'gcx, 'tcx> { impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { fn new(cx: &'a mut TypeChecker<'b, 'gcx, 'tcx>, mir: &'a Mir<'tcx>) -> Self { TypeVerifier { - cx: cx, - mir: mir, + cx, + mir, last_span: mir.span, errors_reported: false } @@ -235,8 +235,8 @@ impl<'a, 'b, 'gcx, 'tcx> TypeVerifier<'a, 'b, 'gcx, 'tcx> { } } else { LvalueTy::Downcast { - adt_def: adt_def, - substs: substs, + adt_def, + substs, variant_index: index } } @@ -333,7 +333,7 @@ impl<'a, 'gcx, 'tcx> TypeChecker<'a, 'gcx, 'tcx> { param_env: ty::ParamEnv<'gcx>) -> Self { TypeChecker { - infcx: infcx, + infcx, fulfillment_cx: traits::FulfillmentContext::new(), last_span: DUMMY_SP, body_id, diff --git a/src/librustc_mir/util/def_use.rs b/src/librustc_mir/util/def_use.rs index d20d50c5611..8dc5e31445b 100644 --- a/src/librustc_mir/util/def_use.rs +++ b/src/librustc_mir/util/def_use.rs @@ -97,8 +97,8 @@ impl<'tcx> Visitor<'tcx> for DefUseFinder<'tcx> { location: Location) { if let Some(ref mut info) = self.lvalue_mut_info(lvalue) { info.defs_and_uses.push(Use { - context: context, - location: location, + context, + location, }) } self.super_lvalue(lvalue, context, location) @@ -140,8 +140,8 @@ impl<'tcx, F> MutateUseVisitor<'tcx, F> { -> MutateUseVisitor<'tcx, F> where F: for<'a> FnMut(&'a mut Lvalue<'tcx>, LvalueContext<'tcx>, Location) { MutateUseVisitor { - query: query, - callback: callback, + query, + callback, phantom: PhantomData, } } diff --git a/src/librustc_mir/util/elaborate_drops.rs b/src/librustc_mir/util/elaborate_drops.rs index da7e218439c..d8a061f4b19 100644 --- a/src/librustc_mir/util/elaborate_drops.rs +++ b/src/librustc_mir/util/elaborate_drops.rs @@ -521,7 +521,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> let substs = tcx.mk_substs(iter::once(Kind::from(ty))); let ref_ty = tcx.mk_ref(tcx.types.re_erased, ty::TypeAndMut { - ty: ty, + ty, mutbl: hir::Mutability::MutMutable }); let ref_lvalue = self.new_temp(ref_ty); @@ -860,7 +860,7 @@ impl<'l, 'b, 'tcx, D> DropCtxt<'l, 'b, 'tcx, D> fn drop_block<'a>(&mut self, target: BasicBlock, unwind: Unwind) -> BasicBlock { let block = TerminatorKind::Drop { location: self.lvalue.clone(), - target: target, + target, unwind: unwind.into_option() }; self.new_block(unwind, block) diff --git a/src/librustc_mir/util/patch.rs b/src/librustc_mir/util/patch.rs index ac121131eb9..1af0b6c67f2 100644 --- a/src/librustc_mir/util/patch.rs +++ b/src/librustc_mir/util/patch.rs @@ -156,7 +156,7 @@ impl<'tcx> MirPatch<'tcx> { ); mir[loc.block].statements.insert( loc.statement_index, Statement { - source_info: source_info, + source_info, kind: stmt }); delta += 1; diff --git a/src/librustc_passes/consts.rs b/src/librustc_passes/consts.rs index 9185f73974c..763f885b4d0 100644 --- a/src/librustc_passes/consts.rs +++ b/src/librustc_passes/consts.rs @@ -470,7 +470,7 @@ fn check_adjustments<'a, 'tcx>(v: &mut CheckCrateVisitor<'a, 'tcx>, e: &hir::Exp pub fn check_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>) { tcx.hir.krate().visit_all_item_likes(&mut CheckCrateVisitor { - tcx: tcx, + tcx, tables: &ty::TypeckTables::empty(None), in_fn: false, promotable: false, diff --git a/src/librustc_passes/loops.rs b/src/librustc_passes/loops.rs index 21a4c007fb1..1b2a07cd1a7 100644 --- a/src/librustc_passes/loops.rs +++ b/src/librustc_passes/loops.rs @@ -51,7 +51,7 @@ struct CheckLoopVisitor<'a, 'hir: 'a> { pub fn check_crate(sess: &Session, map: &Map) { let krate = map.krate(); krate.visit_all_item_likes(&mut CheckLoopVisitor { - sess: sess, + sess, hir_map: map, cx: Normal, }.as_deep_visitor()); diff --git a/src/librustc_passes/static_recursion.rs b/src/librustc_passes/static_recursion.rs index 0dbb2d1d4d0..987243b5234 100644 --- a/src/librustc_passes/static_recursion.rs +++ b/src/librustc_passes/static_recursion.rs @@ -91,8 +91,8 @@ pub fn check_crate<'hir>(sess: &Session, hir_map: &hir_map::Map<'hir>) -> Result<(), ErrorReported> { let mut visitor = CheckCrateVisitor { - sess: sess, - hir_map: hir_map, + sess, + hir_map, discriminant_map: NodeMap(), detected_recursive_ids: NodeSet(), }; diff --git a/src/librustc_plugin/load.rs b/src/librustc_plugin/load.rs index ed49e8a14c8..aba56788928 100644 --- a/src/librustc_plugin/load.rs +++ b/src/librustc_plugin/load.rs @@ -91,7 +91,7 @@ pub fn load_plugins(sess: &Session, impl<'a> PluginLoader<'a> { fn new(sess: &'a Session, cstore: &'a CStore, crate_name: &str) -> Self { PluginLoader { - sess: sess, + sess, reader: CrateLoader::new(sess, cstore, crate_name), plugins: vec![], } @@ -104,8 +104,8 @@ impl<'a> PluginLoader<'a> { let symbol = self.sess.generate_plugin_registrar_symbol(disambiguator, index); let fun = self.dylink_registrar(span, lib, symbol); self.plugins.push(PluginRegistrar { - fun: fun, - args: args, + fun, + args, }); } } diff --git a/src/librustc_plugin/registry.rs b/src/librustc_plugin/registry.rs index aac21f2af0d..3f74093241d 100644 --- a/src/librustc_plugin/registry.rs +++ b/src/librustc_plugin/registry.rs @@ -67,9 +67,9 @@ impl<'a> Registry<'a> { #[doc(hidden)] pub fn new(sess: &'a Session, krate_span: Span) -> Registry<'a> { Registry { - sess: sess, + sess, args_hidden: None, - krate_span: krate_span, + krate_span, syntax_exts: vec![], early_lint_passes: vec![], late_lint_passes: vec![], diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs index 983f478e07d..959528612c3 100644 --- a/src/librustc_privacy/lib.rs +++ b/src/librustc_privacy/lib.rs @@ -1496,9 +1496,9 @@ impl<'a, 'tcx> PrivateItemsInPublicInterfacesVisitor<'a, 'tcx> { item_def_id: self.tcx.hir.local_def_id(item_id), span: self.tcx.hir.span(item_id), min_visibility: ty::Visibility::Public, - required_visibility: required_visibility, + required_visibility, has_pub_restricted: self.has_pub_restricted, - has_old_errors: has_old_errors, + has_old_errors, } } } @@ -1660,7 +1660,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Check privacy of names not checked in previous compilation stages. let mut visitor = NamePrivacyVisitor { - tcx: tcx, + tcx, tables: &empty_tables, current_item: CRATE_NODE_ID, empty_tables: &empty_tables, @@ -1670,7 +1670,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Check privacy of explicitly written types and traits as well as // inferred types of expressions and patterns. let mut visitor = TypePrivacyVisitor { - tcx: tcx, + tcx, tables: &empty_tables, current_item: DefId::local(CRATE_DEF_INDEX), span: krate.span, @@ -1681,7 +1681,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Build up a set of all exported items in the AST. This is a set of all // items which are reachable from external crates based on visibility. let mut visitor = EmbargoVisitor { - tcx: tcx, + tcx, access_levels: Default::default(), prev_level: Some(AccessLevel::Public), changed: false, @@ -1698,7 +1698,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, { let mut visitor = ObsoleteVisiblePrivateTypesVisitor { - tcx: tcx, + tcx, access_levels: &visitor.access_levels, in_variant: false, old_error_set: NodeSet(), @@ -1708,7 +1708,7 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let has_pub_restricted = { let mut pub_restricted_visitor = PubRestrictedVisitor { - tcx: tcx, + tcx, has_pub_restricted: false }; intravisit::walk_crate(&mut pub_restricted_visitor, krate); @@ -1717,8 +1717,8 @@ fn privacy_access_levels<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, // Check for private types and traits in public interfaces let mut visitor = PrivateItemsInPublicInterfacesVisitor { - tcx: tcx, - has_pub_restricted: has_pub_restricted, + tcx, + has_pub_restricted, old_error_set: &visitor.old_error_set, inner_visibility: ty::Visibility::Public, }; diff --git a/src/librustc_resolve/build_reduced_graph.rs b/src/librustc_resolve/build_reduced_graph.rs index a061484b5c4..47fa5357abf 100644 --- a/src/librustc_resolve/build_reduced_graph.rs +++ b/src/librustc_resolve/build_reduced_graph.rs @@ -172,7 +172,7 @@ impl<'a> Resolver<'a> { let subclass = SingleImport { target: binding, - source: source, + source, result: self.per_ns(|_, _| Cell::new(Err(Undetermined))), type_ns_only: false, }; @@ -229,7 +229,7 @@ impl<'a> Resolver<'a> { target: rename, source: ident.node, result: self.per_ns(|_, _| Cell::new(Err(Undetermined))), - type_ns_only: type_ns_only, + type_ns_only, }; let id = source_item.node.id; self.add_import_directive( @@ -239,7 +239,7 @@ impl<'a> Resolver<'a> { } ViewPathGlob(_) => { let subclass = GlobImport { - is_prelude: is_prelude, + is_prelude, max_vis: Cell::new(ty::Visibility::Invisible), }; self.add_import_directive( @@ -262,13 +262,13 @@ impl<'a> Resolver<'a> { (module, ty::Visibility::Public, sp, expansion).to_name_binding(self.arenas); let directive = self.arenas.alloc_import_directive(ImportDirective { id: item.id, - parent: parent, + parent, imported_module: Cell::new(Some(module)), subclass: ImportDirectiveSubclass::ExternCrate, span: item.span, module_path: Vec::new(), vis: Cell::new(vis), - expansion: expansion, + expansion, used: Cell::new(used), }); self.potentially_unused_imports.push(directive); @@ -618,10 +618,10 @@ impl<'a> Resolver<'a> { parent: graph_root, imported_module: Cell::new(Some(module)), subclass: ImportDirectiveSubclass::MacroUse, - span: span, + span, module_path: Vec::new(), vis: Cell::new(ty::Visibility::Restricted(DefId::local(CRATE_DEF_INDEX))), - expansion: expansion, + expansion, used: Cell::new(false), }); diff --git a/src/librustc_resolve/check_unused.rs b/src/librustc_resolve/check_unused.rs index a8bb6619bbd..05c227340d8 100644 --- a/src/librustc_resolve/check_unused.rs +++ b/src/librustc_resolve/check_unused.rs @@ -135,7 +135,7 @@ pub fn check_crate(resolver: &mut Resolver, krate: &ast::Crate) { } let mut visitor = UnusedImportCheckVisitor { - resolver: resolver, + resolver, unused_imports: NodeMap(), }; visit::walk_crate(&mut visitor, krate); diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index da170e7fe22..2502f04ee6a 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -793,7 +793,7 @@ impl<'a> Rib<'a> { fn new(kind: RibKind<'a>) -> Rib<'a> { Rib { bindings: FxHashMap(), - kind: kind, + kind, } } } @@ -875,9 +875,9 @@ impl<'a> ModuleData<'a> { expansion: Mark, span: Span) -> Self { ModuleData { - parent: parent, - kind: kind, - normal_ancestor_id: normal_ancestor_id, + parent, + kind, + normal_ancestor_id, resolutions: RefCell::new(FxHashMap()), legacy_macro_resolutions: RefCell::new(Vec::new()), macro_resolutions: RefCell::new(Vec::new()), @@ -887,8 +887,8 @@ impl<'a> ModuleData<'a> { globs: RefCell::new((Vec::new())), traits: RefCell::new(None), populated: Cell::new(normal_ancestor_id.is_local()), - span: span, - expansion: expansion, + span, + expansion, } } @@ -1356,13 +1356,13 @@ impl<'a> Resolver<'a> { macro_defs.insert(Mark::root(), root_def_id); Resolver { - session: session, + session, - definitions: definitions, + definitions, // The outermost module has def ID 0; this is not reflected in the // AST. - graph_root: graph_root, + graph_root, prelude: None, has_self: FxHashSet(), @@ -1389,7 +1389,7 @@ impl<'a> Resolver<'a> { freevars_seen: NodeMap(), export_map: NodeMap(), trait_map: NodeMap(), - module_map: module_map, + module_map, block_map: NodeMap(), extern_module_map: FxHashMap(), @@ -1404,7 +1404,7 @@ impl<'a> Resolver<'a> { gated_errors: FxHashSet(), disallowed_shadowing: Vec::new(), - arenas: arenas, + arenas, dummy_binding: arenas.alloc_name_binding(NameBinding { kind: NameBindingKind::Def(Def::Err), expansion: Mark::root(), @@ -1416,14 +1416,14 @@ impl<'a> Resolver<'a> { use_extern_macros: features.use_extern_macros || features.proc_macro || features.decl_macro, - crate_loader: crate_loader, + crate_loader, macro_names: FxHashSet(), global_macros: FxHashMap(), lexical_macro_resolutions: Vec::new(), macro_map: FxHashMap(), macro_exports: Vec::new(), - invocations: invocations, - macro_defs: macro_defs, + invocations, + macro_defs, local_macro_def_scopes: FxHashMap(), name_already_seen: FxHashMap(), whitelisted_legacy_custom_derives: Vec::new(), @@ -1502,7 +1502,7 @@ impl<'a> Resolver<'a> { NameBindingKind::Import { .. } => false, NameBindingKind::Ambiguity { b1, b2, legacy } => { self.ambiguity_errors.push(AmbiguityError { - span: span, name: ident.name, lexical: false, b1: b1, b2: b2, legacy: legacy, + span: span, name: ident.name, lexical: false, b1: b1, b2: b2, legacy, }); if legacy { self.record_use(ident, ns, b1, span); @@ -2915,7 +2915,7 @@ impl<'a> Resolver<'a> { if record_used { vec.push(Freevar { def: prev_def, - span: span, + span, }); seen.insert(node_id, depth); } diff --git a/src/librustc_resolve/macros.rs b/src/librustc_resolve/macros.rs index 7572c4aa680..f8dc341653e 100644 --- a/src/librustc_resolve/macros.rs +++ b/src/librustc_resolve/macros.rs @@ -273,7 +273,7 @@ impl<'a> base::Resolver for Resolver<'a> { id: attr::mk_attr_id(), style: ast::AttrStyle::Outer, is_sugared_doc: false, - span: span, + span, }); } } @@ -491,7 +491,7 @@ impl<'a> Resolver<'a> { let name = ident.name; self.ambiguity_errors.push(AmbiguityError { span: path_span, - name: name, + name, b1: shadower, b2: binding, lexical: true, diff --git a/src/librustc_resolve/resolve_imports.rs b/src/librustc_resolve/resolve_imports.rs index 26c398379dc..5616971e9d1 100644 --- a/src/librustc_resolve/resolve_imports.rs +++ b/src/librustc_resolve/resolve_imports.rs @@ -165,7 +165,7 @@ impl<'a> Resolver<'a> { binding.def() != shadowed_glob.def() { self.ambiguity_errors.push(AmbiguityError { span: path_span, - name: name, + name, lexical: false, b1: binding, b2: shadowed_glob, @@ -265,13 +265,13 @@ impl<'a> Resolver<'a> { let current_module = self.current_module; let directive = self.arenas.alloc_import_directive(ImportDirective { parent: current_module, - module_path: module_path, + module_path, imported_module: Cell::new(None), - subclass: subclass, - span: span, - id: id, + subclass, + span, + id, vis: Cell::new(vis), - expansion: expansion, + expansion, used: Cell::new(false), }); @@ -311,13 +311,13 @@ impl<'a> Resolver<'a> { self.arenas.alloc_name_binding(NameBinding { kind: NameBindingKind::Import { - binding: binding, - directive: directive, + binding, + directive, used: Cell::new(false), legacy_self_import: false, }, span: directive.span, - vis: vis, + vis, expansion: directive.expansion, }) } @@ -661,8 +661,8 @@ impl<'a, 'b:'a> ImportResolver<'a, 'b> { legacy_self_import = Some(directive); let binding = this.arenas.alloc_name_binding(NameBinding { kind: NameBindingKind::Import { - binding: binding, - directive: directive, + binding, + directive, used: Cell::new(false), legacy_self_import: true, }, diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 658b6dbc4e3..619ebbc5422 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -83,8 +83,8 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> DumpVisitor<'l, 'tcx, 'll, O> { let span_utils = SpanUtils::new(&save_ctxt.tcx.sess); DumpVisitor { tcx: save_ctxt.tcx, - save_ctxt: save_ctxt, - dumper: dumper, + save_ctxt, + dumper, span: span_utils.clone(), cur_scope: CRATE_NODE_ID, // mac_defs: HashSet::new(), @@ -1351,7 +1351,7 @@ impl<'l, 'tcx: 'l, 'll, O: DumpOutput + 'll> Visitor<'l> for DumpVisitor<'l, 'tc self.span_from_span(sub_span.expect("No span found for var ref")); self.dumper.dump_ref(Ref { kind: RefKind::Variable, - span: span, + span, ref_id: ::id_from_def_id(def.struct_variant().fields[idx.node].did), }); } diff --git a/src/librustc_save_analysis/lib.rs b/src/librustc_save_analysis/lib.rs index c3d071d27d6..f16ce13b2d5 100644 --- a/src/librustc_save_analysis/lib.rs +++ b/src/librustc_save_analysis/lib.rs @@ -881,7 +881,7 @@ pub struct DumpHandler<'a> { impl<'a> DumpHandler<'a> { pub fn new(odir: Option<&'a Path>, cratename: &str) -> DumpHandler<'a> { DumpHandler { - odir: odir, + odir, cratename: cratename.to_owned() } } @@ -976,9 +976,9 @@ pub fn process_crate<'l, 'tcx, H: SaveHandler>(tcx: TyCtxt<'l, 'tcx, 'tcx>, info!("Dumping crate {}", cratename); let save_ctxt = SaveContext { - tcx: tcx, + tcx, tables: &ty::TypeckTables::empty(None), - analysis: analysis, + analysis, span_utils: SpanUtils::new(&tcx.sess), config: find_config(config), }; @@ -1048,7 +1048,7 @@ fn lower_attributes(attrs: Vec, scx: &SaveContext) -> Vec) -> Signature { fn text_sig(text: String) -> Signature { Signature { - text: text, + text, defs: vec![], refs: vec![], } @@ -706,8 +706,8 @@ impl Sig for ast::Variant_ { text.push('}'); Ok(Signature { text, - defs: defs, - refs: refs, + defs, + refs, }) } ast::VariantData::Tuple(ref fields, id) => { @@ -729,8 +729,8 @@ impl Sig for ast::Variant_ { text.push(')'); Ok(Signature { text, - defs: defs, - refs: refs, + defs, + refs, }) } ast::VariantData::Unit(id) => { diff --git a/src/librustc_save_analysis/span_utils.rs b/src/librustc_save_analysis/span_utils.rs index 631907b28f8..36e4d09c963 100644 --- a/src/librustc_save_analysis/span_utils.rs +++ b/src/librustc_save_analysis/span_utils.rs @@ -32,7 +32,7 @@ pub struct SpanUtils<'a> { impl<'a> SpanUtils<'a> { pub fn new(sess: &'a Session) -> SpanUtils<'a> { SpanUtils { - sess: sess, + sess, err_count: Cell::new(0), } } diff --git a/src/librustc_trans/abi.rs b/src/librustc_trans/abi.rs index 144b484d7e8..5e50696b560 100644 --- a/src/librustc_trans/abi.rs +++ b/src/librustc_trans/abi.rs @@ -433,7 +433,7 @@ impl<'a, 'tcx> ArgType<'tcx> { fn new(layout: TyLayout<'tcx>) -> ArgType<'tcx> { ArgType { kind: ArgKind::Direct, - layout: layout, + layout, cast: None, pad: None, attrs: ArgAttributes::default() @@ -808,10 +808,10 @@ impl<'a, 'tcx> FnType<'tcx> { } FnType { - args: args, - ret: ret, + args, + ret, variadic: sig.variadic, - cconv: cconv + cconv, } } diff --git a/src/librustc_trans/back/archive.rs b/src/librustc_trans/back/archive.rs index 6ec40bd689c..31dee241de4 100644 --- a/src/librustc_trans/back/archive.rs +++ b/src/librustc_trans/back/archive.rs @@ -89,7 +89,7 @@ impl<'a> ArchiveBuilder<'a> { /// by `config`. pub fn new(config: ArchiveConfig<'a>) -> ArchiveBuilder<'a> { ArchiveBuilder { - config: config, + config, removals: Vec::new(), additions: Vec::new(), should_update_symbols: false, @@ -190,7 +190,7 @@ impl<'a> ArchiveBuilder<'a> { Err(e) => return Err(io::Error::new(io::ErrorKind::Other, e)), }; self.additions.push(Addition::Archive { - archive: archive, + archive, skip: Box::new(skip), }); Ok(()) diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs index a9bd8ea9010..d2c96a877fd 100644 --- a/src/librustc_trans/back/link.rs +++ b/src/librustc_trans/back/link.rs @@ -379,7 +379,7 @@ fn archive_config<'a>(sess: &'a Session, output: &Path, input: Option<&Path>) -> ArchiveConfig<'a> { ArchiveConfig { - sess: sess, + sess, dst: output.to_path_buf(), src: input.map(|p| p.to_path_buf()), lib_search_paths: archive_search_paths(sess), diff --git a/src/librustc_trans/back/linker.rs b/src/librustc_trans/back/linker.rs index b364f92f104..ab401465b56 100644 --- a/src/librustc_trans/back/linker.rs +++ b/src/librustc_trans/back/linker.rs @@ -49,22 +49,22 @@ impl<'a, 'tcx> LinkerInfo { match sess.linker_flavor() { LinkerFlavor::Msvc => { Box::new(MsvcLinker { - cmd: cmd, - sess: sess, + cmd, + sess, info: self }) as Box } LinkerFlavor::Em => { Box::new(EmLinker { - cmd: cmd, - sess: sess, + cmd, + sess, info: self }) as Box } LinkerFlavor::Gcc => { Box::new(GccLinker { - cmd: cmd, - sess: sess, + cmd, + sess, info: self, hinted_static: false, is_ld: false, @@ -72,8 +72,8 @@ impl<'a, 'tcx> LinkerInfo { } LinkerFlavor::Ld => { Box::new(GccLinker { - cmd: cmd, - sess: sess, + cmd, + sess, info: self, hinted_static: false, is_ld: true, diff --git a/src/librustc_trans/back/write.rs b/src/librustc_trans/back/write.rs index 94cae37761f..8ed9daed49b 100644 --- a/src/librustc_trans/back/write.rs +++ b/src/librustc_trans/back/write.rs @@ -237,7 +237,7 @@ impl ModuleConfig { fn new(sess: &Session, passes: Vec) -> ModuleConfig { ModuleConfig { tm: create_target_machine(sess), - passes: passes, + passes, opt_level: None, opt_size: None, @@ -426,8 +426,8 @@ unsafe fn optimize_and_codegen(cgcx: &CodegenContext, let tm = config.tm; let fv = HandlerFreeVars { - cgcx: cgcx, - diag_handler: diag_handler, + cgcx, + diag_handler, }; let fv = &fv as *const HandlerFreeVars as *mut c_void; @@ -1012,9 +1012,9 @@ fn build_work_item(mtrans: ModuleTranslation, -> WorkItem { WorkItem { - mtrans: mtrans, - config: config, - output_names: output_names + mtrans, + config, + output_names, } } @@ -1136,17 +1136,17 @@ fn start_executing_work(sess: &Session, let cgcx = CodegenContext { crate_types: sess.crate_types.borrow().clone(), - each_linked_rlib_for_lto: each_linked_rlib_for_lto, + each_linked_rlib_for_lto, lto: sess.lto(), no_landing_pads: sess.no_landing_pads(), opts: Arc::new(sess.opts.clone()), time_passes: sess.time_passes(), - exported_symbols: exported_symbols, + exported_symbols, plugin_passes: sess.plugin_llvm_passes.borrow().clone(), remark: sess.opts.cg.remark.clone(), worker: 0, incr_comp_session_dir: sess.incr_comp_session_dir_opt().map(|r| r.clone()), - coordinator_send: coordinator_send, + coordinator_send, diag_emitter: shared_emitter.clone(), time_graph, }; diff --git a/src/librustc_trans/base.rs b/src/librustc_trans/base.rs index b4a2891f94c..354a85b4d29 100644 --- a/src/librustc_trans/base.rs +++ b/src/librustc_trans/base.rs @@ -99,9 +99,9 @@ impl<'a, 'tcx> StatRecorder<'a, 'tcx> { pub fn new(ccx: &'a CrateContext<'a, 'tcx>, name: String) -> StatRecorder<'a, 'tcx> { let istart = ccx.stats().n_llvm_insns.get(); StatRecorder { - ccx: ccx, + ccx, name: Some(name), - istart: istart, + istart, } } } @@ -1058,8 +1058,8 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, let (llcx, llmod) = context::create_context_and_module(tcx.sess, "allocator"); let modules = ModuleLlvm { - llmod: llmod, - llcx: llcx, + llmod, + llcx, }; time(tcx.sess.time_passes(), "write allocator module", || { allocator::trans(tcx, &modules, kind) diff --git a/src/librustc_trans/builder.rs b/src/librustc_trans/builder.rs index 5103ca5c5e1..8a585e72f59 100644 --- a/src/librustc_trans/builder.rs +++ b/src/librustc_trans/builder.rs @@ -70,8 +70,8 @@ impl<'a, 'tcx> Builder<'a, 'tcx> { llvm::LLVMCreateBuilderInContext(ccx.llcx()) }; Builder { - llbuilder: llbuilder, - ccx: ccx, + llbuilder, + ccx, } } diff --git a/src/librustc_trans/collector.rs b/src/librustc_trans/collector.rs index b31295f4022..ae1b60ae7ba 100644 --- a/src/librustc_trans/collector.rs +++ b/src/librustc_trans/collector.rs @@ -331,8 +331,8 @@ fn collect_roots<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>, { let mut visitor = RootCollector { - scx: scx, - mode: mode, + scx, + mode, exported_symbols, output: &mut roots, }; @@ -1035,9 +1035,9 @@ fn collect_neighbours<'a, 'tcx>(scx: &SharedCrateContext<'a, 'tcx>, let mir = scx.tcx().instance_mir(instance.def); let mut visitor = MirNeighborCollector { - scx: scx, + scx, mir: &mir, - output: output, + output, param_substs: instance.substs, const_context, }; diff --git a/src/librustc_trans/common.rs b/src/librustc_trans/common.rs index 0cc499577bb..09aa3d2335a 100644 --- a/src/librustc_trans/common.rs +++ b/src/librustc_trans/common.rs @@ -177,7 +177,7 @@ pub struct Funclet { impl Funclet { pub fn new(cleanuppad: ValueRef) -> Funclet { Funclet { - cleanuppad: cleanuppad, + cleanuppad, operand: OperandBundleDef::new("funclet", &[cleanuppad]), } } diff --git a/src/librustc_trans/context.rs b/src/librustc_trans/context.rs index bec39e3cde6..8c6bd302e4b 100644 --- a/src/librustc_trans/context.rs +++ b/src/librustc_trans/context.rs @@ -323,10 +323,10 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> { let use_dll_storage_attrs = tcx.sess.target.target.options.is_like_msvc; SharedCrateContext { - tcx: tcx, - check_overflow: check_overflow, - use_dll_storage_attrs: use_dll_storage_attrs, - output_filenames: output_filenames, + tcx, + check_overflow, + use_dll_storage_attrs, + output_filenames, } } @@ -395,10 +395,10 @@ impl<'a, 'tcx> LocalCrateContext<'a, 'tcx> { }; let local_ccx = LocalCrateContext { - llmod: llmod, - llcx: llcx, + llmod, + llcx, stats: Stats::default(), - codegen_unit: codegen_unit, + codegen_unit, crate_trans_items, exported_symbols, instances: RefCell::new(FxHashMap()), @@ -416,7 +416,7 @@ impl<'a, 'tcx> LocalCrateContext<'a, 'tcx> { int_type: Type::from_ref(ptr::null_mut()), opaque_vec_type: Type::from_ref(ptr::null_mut()), str_slice_type: Type::from_ref(ptr::null_mut()), - dbg_cx: dbg_cx, + dbg_cx, eh_personality: Cell::new(None), eh_unwind_resume: Cell::new(None), rust_try_fn: Cell::new(None), @@ -462,7 +462,7 @@ impl<'a, 'tcx> LocalCrateContext<'a, 'tcx> { -> CrateContext<'a, 'tcx> { assert!(local_ccxs.len() == 1); CrateContext { - shared: shared, + shared, local_ccx: &local_ccxs[0] } } diff --git a/src/librustc_trans/debuginfo/create_scope_map.rs b/src/librustc_trans/debuginfo/create_scope_map.rs index ae618c7e170..95f13ea8716 100644 --- a/src/librustc_trans/debuginfo/create_scope_map.rs +++ b/src/librustc_trans/debuginfo/create_scope_map.rs @@ -129,7 +129,7 @@ fn make_mir_scope(ccx: &CrateContext, loc.col.to_usize() as c_uint) }; scopes[scope] = MirDebugScope { - scope_metadata: scope_metadata, + scope_metadata, file_start_pos: loc.file.start_pos, file_end_pos: loc.file.end_pos, }; diff --git a/src/librustc_trans/debuginfo/metadata.rs b/src/librustc_trans/debuginfo/metadata.rs index 61204b88e13..9aba075a20c 100644 --- a/src/librustc_trans/debuginfo/metadata.rs +++ b/src/librustc_trans/debuginfo/metadata.rs @@ -205,11 +205,11 @@ fn create_and_register_recursive_type_forward_declaration<'a, 'tcx>( type_map.register_type_with_metadata(unfinished_type, metadata_stub); UnfinishedMetadata { - unfinished_type: unfinished_type, - unique_type_id: unique_type_id, - metadata_stub: metadata_stub, - llvm_type: llvm_type, - member_description_factory: member_description_factory, + unfinished_type, + unique_type_id, + metadata_stub, + llvm_type, + member_description_factory, } } @@ -847,8 +847,8 @@ struct MetadataCreationResult { impl MetadataCreationResult { fn new(metadata: DIType, already_stored_in_typemap: bool) -> MetadataCreationResult { MetadataCreationResult { - metadata: metadata, - already_stored_in_typemap: already_stored_in_typemap + metadata, + already_stored_in_typemap, } } } @@ -947,10 +947,10 @@ impl<'tcx> StructMemberDescriptionFactory<'tcx> { let offset = FixedMemberOffset { bytes: offsets[i].bytes() as usize}; MemberDescription { - name: name, + name, llvm_type: type_of::in_memory_type_of(cx, fty), type_metadata: type_metadata(cx, fty, self.span), - offset: offset, + offset, flags: DIFlags::FlagZero, } }).collect() @@ -987,9 +987,9 @@ fn prepare_struct_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, struct_llvm_type, StructMDF(StructMemberDescriptionFactory { ty: struct_type, - variant: variant, - substs: substs, - span: span, + variant, + substs, + span, }) ) } @@ -1052,7 +1052,7 @@ fn prepare_tuple_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, TupleMDF(TupleMemberDescriptionFactory { ty: tuple_type, component_types: component_types.to_vec(), - span: span, + span, }) ) } @@ -1111,9 +1111,9 @@ fn prepare_union_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, union_metadata_stub, union_llvm_type, UnionMDF(UnionMemberDescriptionFactory { - variant: variant, - substs: substs, - span: span, + variant, + substs, + span, }) ) } @@ -1462,14 +1462,14 @@ fn describe_enum_variant<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, let member_description_factory = VariantMDF(VariantMemberDescriptionFactory { offsets: &struct_def.offsets[..], - args: args, + args, discriminant_type_metadata: match discriminant_info { RegularDiscriminant(discriminant_type_metadata) => { Some(discriminant_type_metadata) } _ => None }, - span: span, + span, }); (metadata_stub, variant_llvm_type, member_description_factory) @@ -1590,12 +1590,12 @@ fn prepare_enum_metadata<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, enum_metadata, enum_llvm_type, EnumMDF(EnumMemberDescriptionFactory { - enum_type: enum_type, + enum_type, type_rep: type_rep.layout, - discriminant_type_metadata: discriminant_type_metadata, - containing_scope: containing_scope, - file_metadata: file_metadata, - span: span, + discriminant_type_metadata, + containing_scope, + file_metadata, + span, }), ); diff --git a/src/librustc_trans/debuginfo/mod.rs b/src/librustc_trans/debuginfo/mod.rs index 68432c22f81..83366c13453 100644 --- a/src/librustc_trans/debuginfo/mod.rs +++ b/src/librustc_trans/debuginfo/mod.rs @@ -87,9 +87,9 @@ impl<'tcx> CrateDebugContext<'tcx> { // DIBuilder inherits context from the module, so we'd better use the same one let llcontext = unsafe { llvm::LLVMGetModuleContext(llmod) }; CrateDebugContext { - llcontext: llcontext, - llmod: llmod, - builder: builder, + llcontext, + llmod, + builder, created_files: RefCell::new(FxHashMap()), created_enum_disr_types: RefCell::new(FxHashMap()), type_map: RefCell::new(TypeMap::new()), @@ -292,7 +292,7 @@ pub fn create_function_debug_context<'a, 'tcx>(cx: &CrateContext<'a, 'tcx>, // Initialize fn debug context (including scope map and namespace map) let fn_debug_context = FunctionDebugContextData { - fn_metadata: fn_metadata, + fn_metadata, source_locations_enabled: Cell::new(false), defining_crate: def_id.krate, }; diff --git a/src/librustc_trans/debuginfo/source_loc.rs b/src/librustc_trans/debuginfo/source_loc.rs index e99e26261a3..7393802294a 100644 --- a/src/librustc_trans/debuginfo/source_loc.rs +++ b/src/librustc_trans/debuginfo/source_loc.rs @@ -72,9 +72,9 @@ pub enum InternalDebugLocation { impl InternalDebugLocation { pub fn new(scope: DIScope, line: usize, col: usize) -> InternalDebugLocation { KnownLocation { - scope: scope, - line: line, - col: col, + scope, + line, + col, } } } diff --git a/src/librustc_trans/mir/block.rs b/src/librustc_trans/mir/block.rs index 9bb29c340d9..28fe1044e74 100644 --- a/src/librustc_trans/mir/block.rs +++ b/src/librustc_trans/mir/block.rs @@ -673,8 +673,8 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { Ref(ptr, align) }; let op = OperandRef { - val: val, - ty: ty + val, + ty, }; self.trans_argument(bcx, op, llargs, fn_ty, next_idx, llfn, def); } @@ -697,7 +697,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { // If the tuple is immediate, the elements are as well let op = OperandRef { val: Immediate(elem), - ty: ty + ty, }; self.trans_argument(bcx, op, llargs, fn_ty, next_idx, llfn, def); } @@ -713,7 +713,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { // Pair is always made up of immediates let op = OperandRef { val: Immediate(elem), - ty: ty + ty, }; self.trans_argument(bcx, op, llargs, fn_ty, next_idx, llfn, def); } diff --git a/src/librustc_trans/mir/constant.rs b/src/librustc_trans/mir/constant.rs index 53469689bc7..293e6462de2 100644 --- a/src/librustc_trans/mir/constant.rs +++ b/src/librustc_trans/mir/constant.rs @@ -57,8 +57,8 @@ pub struct Const<'tcx> { impl<'tcx> Const<'tcx> { pub fn new(llval: ValueRef, ty: Ty<'tcx>) -> Const<'tcx> { Const { - llval: llval, - ty: ty + llval, + ty, } } @@ -158,7 +158,7 @@ impl<'tcx> Const<'tcx> { }; OperandRef { - val: val, + val, ty: self.ty } } @@ -247,9 +247,9 @@ impl<'a, 'tcx> MirConstContext<'a, 'tcx> { args: IndexVec, ConstEvalErr<'tcx>>>) -> MirConstContext<'a, 'tcx> { let mut context = MirConstContext { - ccx: ccx, - mir: mir, - substs: substs, + ccx, + mir, + substs, locals: (0..mir.local_decls.len()).map(|_| None).collect(), }; for (i, arg) in args.into_iter().enumerate() { @@ -491,7 +491,7 @@ impl<'a, 'tcx> MirConstContext<'a, 'tcx> { }; ConstLvalue { base: projected, - llextra: llextra, + llextra, ty: projected_ty } } diff --git a/src/librustc_trans/mir/lvalue.rs b/src/librustc_trans/mir/lvalue.rs index af8976967a1..89c76ccdd27 100644 --- a/src/librustc_trans/mir/lvalue.rs +++ b/src/librustc_trans/mir/lvalue.rs @@ -380,7 +380,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { }; LvalueRef { llval: llprojected, - llextra: llextra, + llextra, ty: projected_ty, alignment: align, } diff --git a/src/librustc_trans/mir/mod.rs b/src/librustc_trans/mir/mod.rs index d0f7f27d5a8..a67fa070324 100644 --- a/src/librustc_trans/mir/mod.rs +++ b/src/librustc_trans/mir/mod.rs @@ -228,19 +228,19 @@ pub fn trans_mir<'a, 'tcx: 'a>( let (landing_pads, funclets) = create_funclets(&bcx, &cleanup_kinds, &block_bcxs); let mut mircx = MirContext { - mir: mir, - llfn: llfn, - fn_ty: fn_ty, - ccx: ccx, + mir, + llfn, + fn_ty, + ccx, llpersonalityslot: None, blocks: block_bcxs, unreachable_block: None, - cleanup_kinds: cleanup_kinds, - landing_pads: landing_pads, + cleanup_kinds, + landing_pads, funclets: &funclets, - scopes: scopes, + scopes, locals: IndexVec::new(), - debug_context: debug_context, + debug_context, param_substs: { assert!(!instance.substs.needs_infer()); instance.substs @@ -486,7 +486,7 @@ fn arg_local_refs<'a, 'tcx>(bcx: &Builder<'a, 'tcx>, OperandValue::Immediate(llarg) }; let operand = OperandRef { - val: val, + val, ty: arg_ty }; return LocalRef::Operand(Some(operand.unpack_if_pair(bcx))); diff --git a/src/librustc_trans/mir/operand.rs b/src/librustc_trans/mir/operand.rs index 1b8a05b6f6c..9ce1749190b 100644 --- a/src/librustc_trans/mir/operand.rs +++ b/src/librustc_trans/mir/operand.rs @@ -98,8 +98,8 @@ impl<'a, 'tcx> OperandRef<'tcx> { OperandValue::Immediate(C_null(llty)) }; OperandRef { - val: val, - ty: ty + val, + ty, } } @@ -122,7 +122,7 @@ impl<'a, 'tcx> OperandRef<'tcx> { }; LvalueRef { llval: llptr, - llextra: llextra, + llextra, ty: LvalueTy::from_ty(projected_ty), alignment: Alignment::AbiAligned, } diff --git a/src/librustc_trans/mir/rvalue.rs b/src/librustc_trans/mir/rvalue.rs index a23e1a0684b..8051e04060a 100644 --- a/src/librustc_trans/mir/rvalue.rs +++ b/src/librustc_trans/mir/rvalue.rs @@ -148,9 +148,9 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { dest.llval, dest.ty, dest.alignment); let field_index = active_field_index.unwrap_or(i); val.ty = LvalueTy::Downcast { - adt_def: adt_def, + adt_def, substs: self.monomorphize(&substs), - variant_index: variant_index, + variant_index, }; let (lldest_i, align) = val.trans_field_ptr(&bcx, field_index); self.store_operand(&bcx, lldest_i, align.to_align(), op); @@ -348,7 +348,7 @@ impl<'a, 'tcx> MirContext<'a, 'tcx> { } }; let operand = OperandRef { - val: val, + val, ty: cast_ty }; (bcx, operand) diff --git a/src/librustc_trans/trans_item.rs b/src/librustc_trans/trans_item.rs index b94fd13c3a4..38232ed1d11 100644 --- a/src/librustc_trans/trans_item.rs +++ b/src/librustc_trans/trans_item.rs @@ -384,9 +384,9 @@ impl<'a, 'tcx> DefPathBasedNames<'a, 'tcx> { omit_local_crate_name: bool) -> Self { DefPathBasedNames { - tcx: tcx, - omit_disambiguators: omit_disambiguators, - omit_local_crate_name: omit_local_crate_name, + tcx, + omit_disambiguators, + omit_local_crate_name, } } diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 2910d25486e..32fa0534db6 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -117,8 +117,8 @@ impl<'o, 'gcx: 'tcx, 'tcx> AstConv<'gcx, 'tcx>+'o { let name = tcx.hir.name(id); tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { def_id: tcx.hir.local_def_id(id), - index: index, - name: name + index, + name, })) } diff --git a/src/librustc_typeck/check/autoderef.rs b/src/librustc_typeck/check/autoderef.rs index 6aac9dc42ee..e0e946a9c63 100644 --- a/src/librustc_typeck/check/autoderef.rs +++ b/src/librustc_typeck/check/autoderef.rs @@ -217,7 +217,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { cur_ty: self.resolve_type_vars_if_possible(&base_ty), obligations: vec![], at_start: true, - span: span, + span, } } diff --git a/src/librustc_typeck/check/cast.rs b/src/librustc_typeck/check/cast.rs index b18b11f3d90..9c6cacb9d25 100644 --- a/src/librustc_typeck/check/cast.rs +++ b/src/librustc_typeck/check/cast.rs @@ -136,12 +136,12 @@ impl<'a, 'gcx, 'tcx> CastCheck<'tcx> { span: Span) -> Result, ErrorReported> { let check = CastCheck { - expr: expr, - expr_ty: expr_ty, - expr_diverges: expr_diverges, - cast_ty: cast_ty, - cast_span: cast_span, - span: span, + expr, + expr_ty, + expr_diverges, + cast_ty, + cast_span, + span, }; // For better error messages, check for some obviously unsized diff --git a/src/librustc_typeck/check/coercion.rs b/src/librustc_typeck/check/coercion.rs index 53f3d811fae..48671e864b2 100644 --- a/src/librustc_typeck/check/coercion.rs +++ b/src/librustc_typeck/check/coercion.rs @@ -128,8 +128,8 @@ fn success<'tcx>(adj: Vec>, impl<'f, 'gcx, 'tcx> Coerce<'f, 'gcx, 'tcx> { fn new(fcx: &'f FnCtxt<'f, 'gcx, 'tcx>, cause: ObligationCause<'tcx>) -> Self { Coerce { - fcx: fcx, - cause: cause, + fcx, + cause, use_lub: false, } } diff --git a/src/librustc_typeck/check/method/confirm.rs b/src/librustc_typeck/check/method/confirm.rs index 355e6cdbbe0..cd2adfb7ab0 100644 --- a/src/librustc_typeck/check/method/confirm.rs +++ b/src/librustc_typeck/check/method/confirm.rs @@ -69,10 +69,10 @@ impl<'a, 'gcx, 'tcx> ConfirmContext<'a, 'gcx, 'tcx> { call_expr: &'gcx hir::Expr) -> ConfirmContext<'a, 'gcx, 'tcx> { ConfirmContext { - fcx: fcx, - span: span, - self_expr: self_expr, - call_expr: call_expr, + fcx, + span, + self_expr, + call_expr, } } diff --git a/src/librustc_typeck/check/method/mod.rs b/src/librustc_typeck/check/method/mod.rs index a1c987f22e0..34cc6027a64 100644 --- a/src/librustc_typeck/check/method/mod.rs +++ b/src/librustc_typeck/check/method/mod.rs @@ -83,10 +83,10 @@ impl<'tcx> NoMatchData<'tcx> { mode: probe::Mode) -> Self { NoMatchData { - static_candidates: static_candidates, - unsatisfied_predicates: unsatisfied_predicates, - out_of_scope_traits: out_of_scope_traits, - mode: mode, + static_candidates, + unsatisfied_predicates, + out_of_scope_traits, + mode, } } } @@ -331,7 +331,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { ty::Predicate::WellFormed(method_ty))); let callee = MethodCallee { - def_id: def_id, + def_id, substs: trait_ref.substs, sig: fn_sig, }; diff --git a/src/librustc_typeck/check/method/probe.rs b/src/librustc_typeck/check/method/probe.rs index 5de4a35bdc7..4cb5eef4563 100644 --- a/src/librustc_typeck/check/method/probe.rs +++ b/src/librustc_typeck/check/method/probe.rs @@ -253,7 +253,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { } } else { vec![CandidateStep { - self_ty: self_ty, + self_ty, autoderefs: 0, unsize: false, }] @@ -361,15 +361,15 @@ impl<'a, 'gcx, 'tcx> ProbeContext<'a, 'gcx, 'tcx> { opt_simplified_steps: Option>) -> ProbeContext<'a, 'gcx, 'tcx> { ProbeContext { - fcx: fcx, - span: span, - mode: mode, - looking_for: looking_for, + fcx, + span, + mode, + looking_for, inherent_candidates: Vec::new(), extension_candidates: Vec::new(), impl_dups: FxHashSet(), steps: Rc::new(steps), - opt_simplified_steps: opt_simplified_steps, + opt_simplified_steps, static_candidates: Vec::new(), private_candidate: None, unsatisfied_predicates: Vec::new(), diff --git a/src/librustc_typeck/check/method/suggest.rs b/src/librustc_typeck/check/method/suggest.rs index 56eacc3194d..2337e989be4 100644 --- a/src/librustc_typeck/check/method/suggest.rs +++ b/src/librustc_typeck/check/method/suggest.rs @@ -584,7 +584,7 @@ pub fn all_traits<'a, 'gcx, 'tcx>(tcx: TyCtxt<'a, 'gcx, 'tcx>) -> AllTraits<'a> let borrow = tcx.all_traits.borrow(); assert!(borrow.is_some()); AllTraits { - borrow: borrow, + borrow, idx: 0, } } diff --git a/src/librustc_typeck/check/mod.rs b/src/librustc_typeck/check/mod.rs index 1b56044710b..bc03c925417 100644 --- a/src/librustc_typeck/check/mod.rs +++ b/src/librustc_typeck/check/mod.rs @@ -393,8 +393,8 @@ impl UnsafetyState { hir::DefaultBlock => (unsafety, self.def, self.unsafe_push_count), }; - UnsafetyState{ def: def, - unsafety: unsafety, + UnsafetyState{ def, + unsafety, unsafe_push_count: count, from_fn: false } } @@ -609,7 +609,7 @@ impl<'a, 'gcx, 'tcx> Inherited<'a, 'gcx, 'tcx> { tables: MaybeInProgressTables { maybe_tables: infcx.in_progress_tables, }, - infcx: infcx, + infcx, fulfillment_cx: RefCell::new(traits::FulfillmentContext::new()), locals: RefCell::new(NodeMap()), deferred_call_resolutions: RefCell::new(DefIdMap()), @@ -1697,7 +1697,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { body_id: ast::NodeId) -> FnCtxt<'a, 'gcx, 'tcx> { FnCtxt { - body_id: body_id, + body_id, param_env, err_count_on_creation: inh.tcx.sess.err_count(), ret_coercion: None, @@ -1709,7 +1709,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { stack: Vec::new(), by_id: NodeMap(), }), - inh: inh, + inh, } } @@ -3783,7 +3783,7 @@ impl<'a, 'gcx, 'tcx> FnCtxt<'a, 'gcx, 'tcx> { }; let ctxt = BreakableCtxt { - coerce: coerce, + coerce, may_break: false, // will get updated if/when we find a `break` }; diff --git a/src/librustc_typeck/check/regionck.rs b/src/librustc_typeck/check/regionck.rs index b187075a36d..73c243d27d1 100644 --- a/src/librustc_typeck/check/regionck.rs +++ b/src/librustc_typeck/check/regionck.rs @@ -232,8 +232,8 @@ impl<'a, 'gcx, 'tcx> RegionCtxt<'a, 'gcx, 'tcx> { Subject(subject): Subject) -> RegionCtxt<'a, 'gcx, 'tcx> { let region_maps = fcx.tcx.region_maps(subject); RegionCtxt { - fcx: fcx, - region_maps: region_maps, + fcx, + region_maps, repeating_scope: initial_repeating_scope, body_id: initial_body_id, call_site_scope: None, diff --git a/src/librustc_typeck/check/wfcheck.rs b/src/librustc_typeck/check/wfcheck.rs index 31e14a6b630..f85835e3800 100644 --- a/src/librustc_typeck/check/wfcheck.rs +++ b/src/librustc_typeck/check/wfcheck.rs @@ -54,7 +54,7 @@ impl<'a, 'gcx, 'tcx> CheckWfFcxBuilder<'a, 'gcx, 'tcx> { let fcx = FnCtxt::new(&inh, param_env, id); let wf_tys = f(&fcx, &mut CheckTypeWellFormedVisitor { tcx: fcx.tcx.global_tcx(), - code: code + code, }); fcx.select_all_obligations_or_error(); fcx.regionck_item(id, span, &wf_tys); @@ -66,7 +66,7 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> { pub fn new(tcx: TyCtxt<'a, 'gcx, 'gcx>) -> CheckTypeWellFormedVisitor<'a, 'gcx> { CheckTypeWellFormedVisitor { - tcx: tcx, + tcx, code: ObligationCauseCode::MiscObligation } } @@ -211,8 +211,8 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> { CheckWfFcxBuilder { inherited: Inherited::build(self.tcx, def_id), code: self.code.clone(), - id: id, - span: span, + id, + span, param_env: self.tcx.param_env(def_id), } } @@ -471,7 +471,7 @@ impl<'a, 'gcx> CheckTypeWellFormedVisitor<'a, 'gcx> { ExplicitSelf::ByReference(region, mutbl) => { fcx.tcx.mk_ref(region, ty::TypeAndMut { ty: self_ty, - mutbl: mutbl + mutbl, }) } ExplicitSelf::ByBox => fcx.tcx.mk_box(self_ty) diff --git a/src/librustc_typeck/check/writeback.rs b/src/librustc_typeck/check/writeback.rs index a363e47a14f..36c72fc4b19 100644 --- a/src/librustc_typeck/check/writeback.rs +++ b/src/librustc_typeck/check/writeback.rs @@ -80,9 +80,9 @@ impl<'cx, 'gcx, 'tcx> WritebackCx<'cx, 'gcx, 'tcx> { let owner = fcx.tcx.hir.definitions().node_to_hir_id(body.id().node_id); WritebackCx { - fcx: fcx, + fcx, tables: ty::TypeckTables::empty(Some(DefId::local(owner.owner))), - body: body + body, } } @@ -445,8 +445,8 @@ impl<'cx, 'gcx, 'tcx> Resolver<'cx, 'gcx, 'tcx> { Resolver { tcx: fcx.tcx, infcx: fcx, - span: span, - body: body, + span, + body, } } diff --git a/src/librustc_typeck/collect.rs b/src/librustc_typeck/collect.rs index 91b41eb33a1..ea86c570c82 100644 --- a/src/librustc_typeck/collect.rs +++ b/src/librustc_typeck/collect.rs @@ -185,8 +185,8 @@ impl<'a, 'tcx> ItemCtxt<'a, 'tcx> { pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>, item_def_id: DefId) -> ItemCtxt<'a,'tcx> { ItemCtxt { - tcx: tcx, - item_def_id: item_def_id, + tcx, + item_def_id, } } } @@ -630,10 +630,10 @@ fn convert_struct_variant<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, } }).collect(); ty::VariantDef { - did: did, - name: name, - discr: discr, - fields: fields, + did, + name, + discr, + fields, ctor_kind: CtorKind::from_hir(def), } } @@ -1028,7 +1028,7 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, types.extend(fv.iter().enumerate().map(|(i, _)| ty::TypeParameterDef { index: type_start + i as u32, name: Symbol::intern(""), - def_id: def_id, + def_id, has_default: false, object_lifetime_default: rl::Set1::Empty, pure_wrt_drop: false, @@ -1043,11 +1043,11 @@ fn generics_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, tcx.alloc_generics(ty::Generics { parent: parent_def_id, - parent_regions: parent_regions, - parent_types: parent_types, - regions: regions, - types: types, - type_param_to_index: type_param_to_index, + parent_regions, + parent_types, + regions, + types, + type_param_to_index, has_self: has_self || parent_has_self, has_late_bound_regions: has_late_bound_regions(tcx, node), }) @@ -1382,7 +1382,7 @@ fn predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ItemTrait(_, ref generics, .., ref items) => { is_trait = Some((ty::TraitRef { - def_id: def_id, + def_id, substs: Substs::identity_for_item(tcx, def_id) }, items)); generics @@ -1441,7 +1441,7 @@ fn predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, for param in early_bound_lifetimes_from_generics(tcx, ast_generics) { let region = tcx.mk_region(ty::ReEarlyBound(ty::EarlyBoundRegion { def_id: tcx.hir.local_def_id(param.lifetime.id), - index: index, + index, name: param.lifetime.name })); index += 1; @@ -1560,7 +1560,7 @@ fn predicates_of<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, ty::GenericPredicates { parent: generics.parent, - predicates: predicates + predicates, } } @@ -1611,10 +1611,10 @@ pub fn compute_bounds<'gcx: 'tcx, 'tcx>(astconv: &AstConv<'gcx, 'tcx>, }; Bounds { - region_bounds: region_bounds, - implicitly_sized: implicitly_sized, - trait_bounds: trait_bounds, - projection_bounds: projection_bounds, + region_bounds, + implicitly_sized, + trait_bounds, + projection_bounds, } } diff --git a/src/librustc_typeck/constrained_type_params.rs b/src/librustc_typeck/constrained_type_params.rs index 37cb1f9280b..09c7487e635 100644 --- a/src/librustc_typeck/constrained_type_params.rs +++ b/src/librustc_typeck/constrained_type_params.rs @@ -48,7 +48,7 @@ pub fn parameters_for<'tcx, T>(t: &T, let mut collector = ParameterCollector { parameters: vec![], - include_nonconstraining: include_nonconstraining + include_nonconstraining, }; t.visit_with(&mut collector); collector.parameters diff --git a/src/librustc_typeck/variance/constraints.rs b/src/librustc_typeck/variance/constraints.rs index 4b0db749964..40474a7933f 100644 --- a/src/librustc_typeck/variance/constraints.rs +++ b/src/librustc_typeck/variance/constraints.rs @@ -73,11 +73,11 @@ pub fn add_constraints_from_crate<'a, 'tcx>(terms_cx: TermsContext<'a, 'tcx>) let invariant = terms_cx.arena.alloc(ConstantTerm(ty::Invariant)); let bivariant = terms_cx.arena.alloc(ConstantTerm(ty::Bivariant)); let mut constraint_cx = ConstraintContext { - terms_cx: terms_cx, - covariant: covariant, - contravariant: contravariant, - invariant: invariant, - bivariant: bivariant, + terms_cx, + covariant, + contravariant, + invariant, + bivariant, constraints: Vec::new(), dependencies: TransitiveRelation::new(), }; @@ -213,7 +213,7 @@ impl<'a, 'tcx> ConstraintContext<'a, 'tcx> { debug!("add_constraint(index={}, variance={:?})", index, variance); self.constraints.push(Constraint { inferred: InferredIndex(current.inferred_start.0 + index as usize), - variance: variance, + variance, }); } diff --git a/src/librustc_typeck/variance/terms.rs b/src/librustc_typeck/variance/terms.rs index 38457146a97..c624b11c5ec 100644 --- a/src/librustc_typeck/variance/terms.rs +++ b/src/librustc_typeck/variance/terms.rs @@ -79,8 +79,8 @@ pub fn determine_parameters_to_be_inferred<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx> arena: &'a mut TypedArena>) -> TermsContext<'a, 'tcx> { let mut terms_cx = TermsContext { - tcx: tcx, - arena: arena, + tcx, + arena, inferred_starts: NodeMap(), inferred_terms: vec![], diff --git a/src/librustdoc/clean/inline.rs b/src/librustdoc/clean/inline.rs index 9b4c4e479d0..5d39d1d27f4 100644 --- a/src/librustdoc/clean/inline.rs +++ b/src/librustdoc/clean/inline.rs @@ -102,7 +102,7 @@ pub fn try_inline(cx: &DocContext, def: Def, name: ast::Name) source: cx.tcx.def_span(did).clean(cx), name: Some(name.clean(cx)), attrs: load_attrs(cx, did), - inner: inner, + inner, visibility: Some(clean::Public), stability: cx.tcx.lookup_stability(did).clean(cx), deprecation: cx.tcx.lookup_deprecation(did).clean(cx), @@ -142,7 +142,7 @@ pub fn build_external_trait(cx: &DocContext, did: DefId) -> clean::Trait { let (generics, supertrait_bounds) = separate_supertrait_bounds(generics); clean::Trait { unsafety: cx.tcx.trait_def(did).unsafety, - generics: generics, + generics, items: trait_items, bounds: supertrait_bounds, } @@ -162,7 +162,7 @@ fn build_external_function(cx: &DocContext, did: DefId) -> clean::Function { decl: (did, sig).clean(cx), generics: (cx.tcx.generics_of(did), &predicates).clean(cx), unsafety: sig.unsafety(), - constness: constness, + constness, abi: sig.abi(), } } @@ -302,7 +302,7 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec) { }), source: tcx.def_span(did).clean(cx), name: None, - attrs: attrs, + attrs, visibility: Some(clean::Inherited), stability: tcx.lookup_stability(did).clean(cx), deprecation: tcx.lookup_deprecation(did).clean(cx), @@ -359,11 +359,11 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec) { }; clean::MethodItem(clean::Method { - unsafety: unsafety, - constness: constness, - decl: decl, - generics: generics, - abi: abi + unsafety, + constness, + decl, + generics, + abi, }) } ref r => panic!("not a tymethod: {:?}", r), @@ -414,15 +414,15 @@ pub fn build_impl(cx: &DocContext, did: DefId, ret: &mut Vec) { inner: clean::ImplItem(clean::Impl { unsafety: hir::Unsafety::Normal, // FIXME: this should be decoded provided_trait_methods: provided, - trait_: trait_, - for_: for_, + trait_, + for_, generics: (tcx.generics_of(did), &predicates).clean(cx), items: trait_items, polarity: Some(polarity.clean(cx)), }), source: tcx.def_span(did).clean(cx), name: None, - attrs: attrs, + attrs, visibility: Some(clean::Inherited), stability: tcx.lookup_stability(did).clean(cx), deprecation: tcx.lookup_deprecation(did).clean(cx), @@ -434,7 +434,7 @@ fn build_module(cx: &DocContext, did: DefId) -> clean::Module { let mut items = Vec::new(); fill_in(cx, did, &mut items); return clean::Module { - items: items, + items, is_crate: false, }; diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 57e72c3a40b..f4aef8ab377 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -156,7 +156,7 @@ impl<'a, 'tcx> Clean for visit_ast::RustdocVisitor<'a, 'tcx> { visibility: Some(Public), stability: get_stability(cx, def_id), deprecation: get_deprecation(cx, def_id), - def_id: def_id, + def_id, inner: PrimitiveItem(prim), } })); @@ -166,11 +166,11 @@ impl<'a, 'tcx> Clean for visit_ast::RustdocVisitor<'a, 'tcx> { let mut external_traits = cx.external_traits.borrow_mut(); Crate { - name: name, - src: src, + name, + src, module: Some(module), - externs: externs, - primitives: primitives, + externs, + primitives, access_levels: Arc::new(mem::replace(&mut access_levels, Default::default())), external_traits: mem::replace(&mut external_traits, Default::default()), } @@ -252,7 +252,7 @@ impl Clean for CrateNum { name: cx.tcx.crate_name(*self).to_string(), src: PathBuf::from(krate_src), attrs: cx.tcx.get_attrs(root).clean(cx), - primitives: primitives, + primitives, } } } @@ -474,7 +474,7 @@ impl Clean for doctree::Module { def_id: cx.tcx.hir.local_def_id(self.id), inner: ModuleItem(Module { is_crate: self.is_crate, - items: items + items, }) } } @@ -519,7 +519,7 @@ impl AttributesExt for [ast::Attribute] { ListAttributesIter { attrs: self.iter(), current_list: Vec::new().into_iter(), - name: name + name, } } } @@ -673,9 +673,9 @@ impl TyParamBound { inline::record_extern_fqn(cx, did, TypeKind::Trait); TraitBound(PolyTrait { trait_: ResolvedPath { - path: path, + path, typarams: None, - did: did, + did, is_generic: false, }, lifetimes: vec![] @@ -715,9 +715,9 @@ fn external_path_params(cx: &DocContext, trait_did: Option, has_self: boo ty::TyTuple(ref tys, _) => tys.iter().map(|t| t.clean(cx)).collect(), _ => { return PathParameters::AngleBracketed { - lifetimes: lifetimes, + lifetimes, types: types.clean(cx), - bindings: bindings + bindings, } } }; @@ -728,15 +728,15 @@ fn external_path_params(cx: &DocContext, trait_did: Option, has_self: boo // _ => Some(types[1].clean(cx)) // }; PathParameters::Parenthesized { - inputs: inputs, - output: output + inputs, + output, } }, _ => { PathParameters::AngleBracketed { - lifetimes: lifetimes, + lifetimes, types: types.clean(cx), - bindings: bindings + bindings, } } } @@ -784,7 +784,7 @@ impl<'tcx> Clean for ty::TraitRef<'tcx> { TraitBound( PolyTrait { trait_: ResolvedPath { - path: path, + path, typarams: None, did: self.def_id, is_generic: false, @@ -1181,7 +1181,7 @@ impl<'a> Clean for (&'a [P], &'a [Spanned]) { name = "_".to_string(); } Argument { - name: name, + name, type_: ty.clean(cx), } }).collect() @@ -1359,7 +1359,7 @@ impl Clean for hir::TraitItem { visibility: None, stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)), deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)), - inner: inner + inner, } } } @@ -1391,7 +1391,7 @@ impl Clean for hir::ImplItem { visibility: self.vis.clean(cx), stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)), deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)), - inner: inner + inner, } } } @@ -1438,8 +1438,8 @@ impl<'tcx> Clean for ty::AssociatedItem { if provided { MethodItem(Method { unsafety: sig.unsafety(), - generics: generics, - decl: decl, + generics, + decl, abi: sig.abi(), // trait methods cannot (currently, at least) be const @@ -1448,8 +1448,8 @@ impl<'tcx> Clean for ty::AssociatedItem { } else { TyMethodItem(TyMethod { unsafety: sig.unsafety(), - generics: generics, - decl: decl, + generics, + decl, abi: sig.abi(), }) } @@ -1515,7 +1515,7 @@ impl<'tcx> Clean for ty::AssociatedItem { def_id: self.def_id, attrs: inline::load_attrs(cx, self.def_id), source: cx.tcx.def_span(self.def_id).clean(cx), - inner: inner, + inner, } } } @@ -1835,7 +1835,7 @@ impl Clean for hir::Ty { } let trait_path = hir::Path { span: self.span, - def: def, + def, segments: vec![].into(), }; Type::QPath { @@ -1854,10 +1854,10 @@ impl Clean for hir::Ty { bounds.push(RegionBound(lifetime.clean(cx))); } ResolvedPath { - path: path, + path, typarams: Some(bounds), - did: did, - is_generic: is_generic, + did, + is_generic, } } _ => Infer // shouldn't happen @@ -1915,9 +1915,9 @@ impl<'tcx> Clean for ty::Ty<'tcx> { let path = external_path(cx, &cx.tcx.item_name(did).as_str(), None, false, vec![], substs); ResolvedPath { - path: path, + path, typarams: None, - did: did, + did, is_generic: false, } } @@ -1935,9 +1935,9 @@ impl<'tcx> Clean for ty::Ty<'tcx> { inline::record_extern_fqn(cx, did, TypeKind::Trait); let bound = TraitBound(PolyTrait { trait_: ResolvedPath { - path: path, + path, typarams: None, - did: did, + did, is_generic: false, }, lifetimes: vec![] @@ -1956,9 +1956,9 @@ impl<'tcx> Clean for ty::Ty<'tcx> { let path = external_path(cx, &cx.tcx.item_name(did).as_str(), Some(did), false, bindings, principal.0.substs); ResolvedPath { - path: path, + path, typarams: Some(typarams), - did: did, + did, is_generic: false, } } else { @@ -2274,7 +2274,7 @@ impl Path { global: false, def: Def::Err, segments: vec![PathSegment { - name: name, + name, params: PathParameters::AngleBracketed { lifetimes: Vec::new(), types: Vec::new(), @@ -2549,9 +2549,9 @@ impl Clean> for doctree::Impl { unsafety: self.unsafety, generics: self.generics.clean(cx), provided_trait_methods: provided, - trait_: trait_, + trait_, for_: self.for_.clean(cx), - items: items, + items, polarity: Some(self.polarity.clean(cx)), }), }); @@ -2745,7 +2745,7 @@ impl Clean for hir::ForeignItem { visibility: self.vis.clean(cx), stability: get_stability(cx, cx.tcx.hir.local_def_id(self.id)), deprecation: get_deprecation(cx, cx.tcx.hir.local_def_id(self.id)), - inner: inner, + inner, } } } @@ -2871,7 +2871,7 @@ fn resolve_use_source(cx: &DocContext, path: Path) -> ImportSource { } else { Some(register_def(cx, path.def)) }, - path: path, + path, } } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 9bb7e4e3a09..58de0e1caec 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -121,18 +121,18 @@ pub fn run_core(search_paths: SearchPaths, let warning_lint = lint::builtin::WARNINGS.name_lower(); let sessopts = config::Options { - maybe_sysroot: maybe_sysroot, - search_paths: search_paths, + maybe_sysroot, + search_paths, crate_types: vec![config::CrateTypeRlib], lint_opts: if !allow_warnings { vec![(warning_lint, lint::Allow)] } else { vec![] }, lint_cap: Some(lint::Allow), - externs: externs, + externs, target_triple: triple.unwrap_or(config::host_triple().to_string()), // Ensure that rustdoc works even if rustc is feature-staged unstable_features: UnstableFeatures::Allow, actually_rustdoc: true, debugging_opts: config::DebuggingOptions { - force_unstable_if_unmarked: force_unstable_if_unmarked, + force_unstable_if_unmarked, ..config::basic_debugging_options() }, ..config::basic_options().clone() @@ -203,7 +203,7 @@ pub fn run_core(search_paths: SearchPaths, }; let ctxt = DocContext { - tcx: tcx, + tcx, populated_all_crate_impls: Cell::new(false), access_levels: RefCell::new(access_levels), external_traits: Default::default(), diff --git a/src/librustdoc/fold.rs b/src/librustdoc/fold.rs index e269d940bfa..54c57c9ac6e 100644 --- a/src/librustdoc/fold.rs +++ b/src/librustdoc/fold.rs @@ -97,9 +97,8 @@ pub trait DocFolder : Sized { _ => self.fold_inner_recur(inner), }; - Some(Item { attrs: attrs, name: name, source: source, inner: inner, - visibility: visibility, stability: stability, deprecation: deprecation, - def_id: def_id }) + Some(Item { attrs, name, source, inner, visibility, + stability, deprecation, def_id }) } fn fold_mod(&mut self, m: Module) -> Module { diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 89a40b0db96..dfbf435d74a 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -164,8 +164,8 @@ impl Writer for U { impl<'a> Classifier<'a> { pub fn new(lexer: lexer::StringReader<'a>, codemap: &'a CodeMap) -> Classifier<'a> { Classifier { - lexer: lexer, - codemap: codemap, + lexer, + codemap, in_attribute: false, in_macro: false, in_macro_nonterminal: false, diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 82c252ae4d7..2d14c02bf8a 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -241,7 +241,7 @@ impl<'a, 'b, I: Iterator>> HeadingLinks<'a, 'b, I> { fn new(iter: I, toc: Option<&'b mut TocBuilder>) -> Self { HeadingLinks { inner: iter, - toc: toc, + toc, buf: VecDeque::new(), } } @@ -1121,15 +1121,15 @@ mod tests { should_panic: bool, no_run: bool, ignore: bool, rust: bool, test_harness: bool, compile_fail: bool, allow_fail: bool, error_codes: Vec) { assert_eq!(LangString::parse(s), LangString { - should_panic: should_panic, - no_run: no_run, - ignore: ignore, - rust: rust, - test_harness: test_harness, - compile_fail: compile_fail, - error_codes: error_codes, + should_panic, + no_run, + ignore, + rust, + test_harness, + compile_fail, + error_codes, original: s.to_owned(), - allow_fail: allow_fail, + allow_fail, }) } diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs index 4e3181759f9..6593d6dfd6c 100644 --- a/src/librustdoc/html/render.rs +++ b/src/librustdoc/html/render.rs @@ -443,8 +443,8 @@ pub fn run(mut krate: clean::Crate, None => PathBuf::new(), }; let mut scx = SharedContext { - src_root: src_root, - passes: passes, + src_root, + passes, include_sources: true, local_sources: FxHashMap(), issue_tracker_base_url: None, @@ -496,10 +496,10 @@ pub fn run(mut krate: clean::Crate, krate = render_sources(&dst, &mut scx, krate)?; let cx = Context { current: Vec::new(), - dst: dst, + dst, render_redirect_pages: false, shared: Arc::new(scx), - render_type: render_type, + render_type, }; // Crawl the crate to build various caches used for the output @@ -518,7 +518,7 @@ pub fn run(mut krate: clean::Crate, let mut cache = Cache { impls: FxHashMap(), - external_paths: external_paths, + external_paths, paths: FxHashMap(), implementors: FxHashMap(), stack: Vec::new(), @@ -531,9 +531,9 @@ pub fn run(mut krate: clean::Crate, access_levels: krate.access_levels.clone(), orphan_impl_items: Vec::new(), traits: mem::replace(&mut krate.external_traits, FxHashMap()), - deref_trait_did: deref_trait_did, - deref_mut_trait_did: deref_mut_trait_did, - owned_box_did: owned_box_did, + deref_trait_did, + deref_mut_trait_did, + owned_box_did, typarams: external_typarams, }; @@ -823,8 +823,8 @@ fn render_sources(dst: &Path, scx: &mut SharedContext, let dst = dst.join("src").join(&krate.name); try_err!(fs::create_dir_all(&dst), &dst); let mut folder = SourceCollector { - dst: dst, - scx: scx, + dst, + scx, }; Ok(folder.fold_crate(krate)) } @@ -1068,7 +1068,7 @@ impl DocFolder for Cache { name: s.to_string(), path: path.join("::").to_string(), desc: plain_summary_line(item.doc_value()), - parent: parent, + parent, parent_idx: None, search_type: get_index_search_type(&item), }); @@ -2038,7 +2038,7 @@ fn item_function(w: &mut fmt::Formatter, cx: &Context, it: &clean::Item, where_clause = WhereClause { gens: &f.generics, indent: 0, end_newline: true }, decl = Method { decl: &f.decl, - name_len: name_len, + name_len, indent: 0, })?; document(w, cx, it) @@ -2406,12 +2406,12 @@ fn render_assoc_item(w: &mut fmt::Formatter, decl = Method { decl: d, name_len: head_len, - indent: indent, + indent, }, where_clause = WhereClause { gens: g, - indent: indent, - end_newline: end_newline, + indent, + end_newline, }) } match item.inner { diff --git a/src/librustdoc/html/static/main.js b/src/librustdoc/html/static/main.js index 8ec9cd8660a..fc5977f533c 100644 --- a/src/librustdoc/html/static/main.js +++ b/src/librustdoc/html/static/main.js @@ -596,9 +596,9 @@ } return { - raw: raw, - query: query, - type: type, + raw, + query, + type, id: query + type }; } @@ -837,7 +837,7 @@ searchWords.push(crate); searchIndex.push({ - crate: crate, + crate, ty: 1, // == ExternCrate name: crate, path: "", diff --git a/src/librustdoc/html/toc.rs b/src/librustdoc/html/toc.rs index a7da1c5cca4..67f371313d0 100644 --- a/src/librustdoc/html/toc.rs +++ b/src/librustdoc/html/toc.rs @@ -161,10 +161,10 @@ impl TocBuilder { } self.chain.push(TocEntry { - level: level, - name: name, - sec_number: sec_number, - id: id, + level, + name, + sec_number, + id, children: Toc { entries: Vec::new() } }); diff --git a/src/librustdoc/plugins.rs b/src/librustdoc/plugins.rs index a38ef2b2518..4fc5159588d 100644 --- a/src/librustdoc/plugins.rs +++ b/src/librustdoc/plugins.rs @@ -35,7 +35,7 @@ impl PluginManager { PluginManager { dylibs: Vec::new(), callbacks: Vec::new(), - prefix: prefix, + prefix, } } diff --git a/src/librustdoc/test.rs b/src/librustdoc/test.rs index b1fb343b8bb..47e8d63f80a 100644 --- a/src/librustdoc/test.rs +++ b/src/librustdoc/test.rs @@ -194,7 +194,7 @@ fn run_test(test: &str, cratename: &str, filename: &str, cfgs: Vec, libs search_paths: libs, crate_types: vec![config::CrateTypeExecutable], output_types: outputs, - externs: externs, + externs, cg: config::CodegenOptions { prefer_dynamic: true, .. config::basic_codegen_options() @@ -416,19 +416,19 @@ impl Collector { tests: Vec::new(), old_tests: HashMap::new(), names: Vec::new(), - cfgs: cfgs, - libs: libs, - externs: externs, + cfgs, + libs, + externs, cnt: 0, - use_headers: use_headers, + use_headers, current_header: None, - cratename: cratename, - opts: opts, - maybe_sysroot: maybe_sysroot, + cratename, + opts, + maybe_sysroot, position: DUMMY_SP, - codemap: codemap, - filename: filename, - render_type: render_type, + codemap, + filename, + render_type, } } @@ -499,7 +499,7 @@ impl Collector { ignore: should_ignore, // compiler failures are test failures should_panic: testing::ShouldPanic::No, - allow_fail: allow_fail, + allow_fail, }, testfn: testing::DynTestFn(box move |()| { let panic = io::set_panic(None); diff --git a/src/librustdoc/visit_ast.rs b/src/librustdoc/visit_ast.rs index 657aab958bb..e3426fba1bc 100644 --- a/src/librustdoc/visit_ast.rs +++ b/src/librustdoc/visit_ast.rs @@ -58,7 +58,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { RustdocVisitor { module: Module::new(None), attrs: hir::HirVec::new(), - cx: cx, + cx, view_item_stack: stack, inlining: false, inside_public_path: true, @@ -99,8 +99,8 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { let struct_type = struct_type_from_def(&*sd); Struct { id: item.id, - struct_type: struct_type, - name: name, + struct_type, + name, vis: item.vis.clone(), stab: self.stability(item.id), depr: self.deprecation(item.id), @@ -118,8 +118,8 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { let struct_type = struct_type_from_def(&*sd); Union { id: item.id, - struct_type: struct_type, - name: name, + struct_type, + name, vis: item.vis.clone(), stab: self.stability(item.id), depr: self.deprecation(item.id), @@ -135,7 +135,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { params: &hir::Generics) -> Enum { debug!("Visiting enum"); Enum { - name: name, + name, variants: def.variants.iter().map(|v| Variant { name: v.node.name, attrs: v.node.attrs.clone(), @@ -169,13 +169,13 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { depr: self.deprecation(item.id), attrs: item.attrs.clone(), decl: fd.clone(), - name: name, + name, whence: item.span, generics: gen.clone(), unsafety: *unsafety, - constness: constness, + constness, abi: *abi, - body: body, + body, } } @@ -221,11 +221,11 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { }; om.macros.push(Macro { - def_id: def_id, + def_id, attrs: def.attrs.clone().into(), name: def.ident.name, whence: def.span, - matchers: matchers, + matchers, stab: self.stability(def.id), depr: self.deprecation(def.id), imported_from: Some(imported_from), @@ -374,7 +374,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { om.extern_crates.push(ExternCrate { cnum: cstore.extern_mod_stmt_cnum(item.id) .unwrap_or(LOCAL_CRATE), - name: name, + name, path: p.map(|x|x.to_string()), vis: item.vis.clone(), attrs: item.attrs.clone(), @@ -408,7 +408,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { } om.imports.push(Import { - name: name, + name, id: item.id, vis: item.vis.clone(), attrs: item.attrs.clone(), @@ -438,7 +438,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { let t = Typedef { ty: ty.clone(), gen: gen.clone(), - name: name, + name, id: item.id, attrs: item.attrs.clone(), whence: item.span, @@ -454,7 +454,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { mutability: mut_.clone(), expr: exp.clone(), id: item.id, - name: name, + name, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), @@ -468,7 +468,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { type_: ty.clone(), expr: exp.clone(), id: item.id, - name: name, + name, attrs: item.attrs.clone(), whence: item.span, vis: item.vis.clone(), @@ -482,9 +482,9 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { .map(|ti| self.cx.tcx.hir.trait_item(ti.id).clone()) .collect(); let t = Trait { - unsafety: unsafety, - name: name, - items: items, + unsafety, + name, + items, generics: gen.clone(), bounds: b.iter().cloned().collect(), id: item.id, @@ -511,13 +511,13 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { .map(|ii| self.cx.tcx.hir.impl_item(ii.id).clone()) .collect(); let i = Impl { - unsafety: unsafety, - polarity: polarity, - defaultness: defaultness, + unsafety, + polarity, + defaultness, generics: gen.clone(), trait_: tr.clone(), for_: ty.clone(), - items: items, + items, attrs: item.attrs.clone(), id: item.id, whence: item.span, @@ -532,7 +532,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { // See comment above about ItemImpl. if !self.inlining { let i = DefaultImpl { - unsafety: unsafety, + unsafety, trait_: trait_ref.clone(), id: item.id, attrs: item.attrs.clone(), @@ -555,7 +555,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> { attrs: def.attrs.clone(), name: def.name, whence: def.span, - matchers: matchers, + matchers, stab: self.stability(def.id), depr: self.deprecation(def.id), imported_from: None, diff --git a/src/librustdoc/visit_lib.rs b/src/librustdoc/visit_lib.rs index 5518d854348..7b5b27c5565 100644 --- a/src/librustdoc/visit_lib.rs +++ b/src/librustdoc/visit_lib.rs @@ -37,7 +37,7 @@ pub struct LibEmbargoVisitor<'a, 'b: 'a, 'tcx: 'b> { impl<'a, 'b, 'tcx> LibEmbargoVisitor<'a, 'b, 'tcx> { pub fn new(cx: &'a ::core::DocContext<'b, 'tcx>) -> LibEmbargoVisitor<'a, 'b, 'tcx> { LibEmbargoVisitor { - cx: cx, + cx, cstore: &*cx.sess().cstore, access_levels: cx.access_levels.borrow_mut(), prev_level: Some(AccessLevel::Public), diff --git a/src/libserialize/json.rs b/src/libserialize/json.rs index dae0b5f0123..5e1c09641e1 100644 --- a/src/libserialize/json.rs +++ b/src/libserialize/json.rs @@ -717,7 +717,7 @@ impl<'a> PrettyEncoder<'a> { /// Creates a new encoder whose output will be written to the specified writer pub fn new(writer: &'a mut fmt::Write) -> PrettyEncoder<'a> { PrettyEncoder { - writer: writer, + writer, curr_indent: 0, indent: 2, is_emitting_map_key: false, @@ -1451,7 +1451,7 @@ impl> Parser { /// Creates the JSON parser. pub fn new(rdr: T) -> Parser { let mut p = Parser { - rdr: rdr, + rdr, ch: Some('\x00'), line: 1, col: 0, diff --git a/src/libserialize/opaque.rs b/src/libserialize/opaque.rs index 9c3db64d4d8..f3475bd18ce 100644 --- a/src/libserialize/opaque.rs +++ b/src/libserialize/opaque.rs @@ -153,8 +153,8 @@ pub struct Decoder<'a> { impl<'a> Decoder<'a> { pub fn new(data: &'a [u8], position: usize) -> Decoder<'a> { Decoder { - data: data, - position: position, + data, + position, } } 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(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(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 HashMap #[stable(feature = "hashmap_build_hasher", since = "1.7.0")] pub fn with_hasher(hash_builder: S) -> HashMap { HashMap { - hash_builder: hash_builder, + hash_builder, resize_policy: DefaultResizePolicy::new(), table: RawTable::new(0), } @@ -679,8 +679,8 @@ impl HashMap 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> { 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 HashSet pub fn difference<'a>(&'a self, other: &'a HashSet) -> Difference<'a, T, S> { Difference { iter: self.iter(), - other: other, + other, } } @@ -391,7 +391,7 @@ impl HashSet pub fn intersection<'a>(&'a self, other: &'a HashSet) -> 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>> Bucket { 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 { Bucket { raw: table.raw_bucket_at(0), - table: table, + table, } } @@ -455,7 +455,7 @@ impl>> EmptyBucket { match self.next().peek() { Full(bucket) => { Ok(GapThenFull { - gap: gap, + gap, full: bucket, }) } @@ -860,8 +860,8 @@ impl RawTable { // 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 RawTable { // 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 BufReader { 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 { 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 Lazy { 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: F) -> Result> { 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::, 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 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 Packet { 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 { impl Weak { pub const fn new(name: &'static str) -> Weak { 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 { pub fn set(stack_guard: Option, 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) -> 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 LocalKey { pub const unsafe fn new(inner: unsafe fn() -> Option<&'static UnsafeCell>>, init: fn() -> T) -> LocalKey { 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 diff --git a/src/libstd_unicode/u_str.rs b/src/libstd_unicode/u_str.rs index 54a5288a57c..1274b062587 100644 --- a/src/libstd_unicode/u_str.rs +++ b/src/libstd_unicode/u_str.rs @@ -87,7 +87,7 @@ impl Utf16Encoder { where I: Iterator { Utf16Encoder { - chars: chars, + chars, extra: 0, } } diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 38ef79822c7..4e6641f4c50 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -135,7 +135,7 @@ impl PathSegment { pub fn crate_root(span: Span) -> Self { PathSegment { identifier: Ident { ctxt: span.ctxt, ..keywords::CrateRoot.ident() }, - span: span, + span, parameters: None, } } @@ -1492,15 +1492,15 @@ impl Arg { let infer_ty = P(Ty { id: DUMMY_NODE_ID, node: TyKind::ImplicitSelf, - span: span, + span, }); let arg = |mutbl, ty| Arg { pat: P(Pat { id: DUMMY_NODE_ID, node: PatKind::Ident(BindingMode::ByValue(mutbl), eself_ident, None), - span: span, + span, }), - ty: ty, + ty, id: DUMMY_NODE_ID, }; match eself.node { @@ -1509,7 +1509,7 @@ impl Arg { SelfKind::Region(lt, mutbl) => arg(Mutability::Immutable, P(Ty { id: DUMMY_NODE_ID, node: TyKind::Rptr(lt, MutTy { ty: infer_ty, mutbl: mutbl }), - span: span, + span, })), } } @@ -1738,7 +1738,7 @@ impl PolyTraitRef { PolyTraitRef { bound_lifetimes: lifetimes, trait_ref: TraitRef { path: path, ref_id: DUMMY_NODE_ID }, - span: span, + span, } } } diff --git a/src/libsyntax/attr.rs b/src/libsyntax/attr.rs index d5caf458fd7..a6c4c404d62 100644 --- a/src/libsyntax/attr.rs +++ b/src/libsyntax/attr.rs @@ -438,7 +438,7 @@ pub fn mk_attr_inner(span: Span, id: AttrId, item: MetaItem) -> Attribute { /// Returns an inner attribute with the given value and span. pub fn mk_spanned_attr_inner(sp: Span, id: AttrId, item: MetaItem) -> Attribute { Attribute { - id: id, + id, style: ast::AttrStyle::Inner, path: ast::Path::from_ident(item.span, ast::Ident::with_empty_ctxt(item.name)), tokens: item.node.tokens(item.span), @@ -456,7 +456,7 @@ pub fn mk_attr_outer(span: Span, id: AttrId, item: MetaItem) -> Attribute { /// Returns an outer attribute with the given value and span. pub fn mk_spanned_attr_outer(sp: Span, id: AttrId, item: MetaItem) -> Attribute { Attribute { - id: id, + id, style: ast::AttrStyle::Outer, path: ast::Path::from_ident(item.span, ast::Ident::with_empty_ctxt(item.name)), tokens: item.node.tokens(item.span), @@ -469,12 +469,12 @@ pub fn mk_sugared_doc_attr(id: AttrId, text: Symbol, span: Span) -> Attribute { let style = doc_comment_style(&text.as_str()); let lit = respan(span, LitKind::Str(text, ast::StrStyle::Cooked)); Attribute { - id: id, - style: style, + id, + style, path: ast::Path::from_ident(span, ast::Ident::from_str("doc")), tokens: MetaItemKind::NameValue(lit).tokens(span), is_sugared_doc: true, - span: span, + span, } } @@ -718,8 +718,8 @@ fn find_stability_generic<'a, I>(diagnostic: &Handler, match (since, reason) { (Some(since), Some(reason)) => { rustc_depr = Some(RustcDeprecation { - since: since, - reason: reason, + since, + reason, }) } (None, _) => { @@ -763,7 +763,7 @@ fn find_stability_generic<'a, I>(diagnostic: &Handler, (Some(feature), reason, Some(issue)) => { stab = Some(Stability { level: Unstable { - reason: reason, + reason, issue: { if let Ok(issue) = issue.as_str().parse() { issue @@ -774,7 +774,7 @@ fn find_stability_generic<'a, I>(diagnostic: &Handler, } } }, - feature: feature, + feature, rustc_depr: None, }) } @@ -817,9 +817,9 @@ fn find_stability_generic<'a, I>(diagnostic: &Handler, (Some(feature), Some(since)) => { stab = Some(Stability { level: Stable { - since: since, + since, }, - feature: feature, + feature, rustc_depr: None, }) } diff --git a/src/libsyntax/codemap.rs b/src/libsyntax/codemap.rs index 6c48b4cadd8..30ae7df9353 100644 --- a/src/libsyntax/codemap.rs +++ b/src/libsyntax/codemap.rs @@ -115,7 +115,7 @@ impl CodeMap { CodeMap { files: RefCell::new(Vec::new()), file_loader: Box::new(RealFileLoader), - path_mapping: path_mapping, + path_mapping, } } @@ -124,8 +124,8 @@ impl CodeMap { -> CodeMap { CodeMap { files: RefCell::new(Vec::new()), - file_loader: file_loader, - path_mapping: path_mapping, + file_loader, + path_mapping, } } @@ -215,13 +215,13 @@ impl CodeMap { let filemap = Rc::new(FileMap { name: filename, - name_was_remapped: name_was_remapped, - crate_of_origin: crate_of_origin, + name_was_remapped, + crate_of_origin, src: None, - src_hash: src_hash, + src_hash, external_src: RefCell::new(ExternalSource::AbsentOk), - start_pos: start_pos, - end_pos: end_pos, + start_pos, + end_pos, lines: RefCell::new(file_local_lines), multibyte_chars: RefCell::new(file_local_multibyte_chars), }); @@ -255,7 +255,7 @@ impl CodeMap { assert!(chpos >= linechpos); Loc { file: f, - line: line, + line, col: chpos - linechpos, } } @@ -385,15 +385,15 @@ impl CodeMap { let line_len = lo.file.get_line(line_index) .map(|s| s.chars().count()) .unwrap_or(0); - lines.push(LineInfo { line_index: line_index, - start_col: start_col, + lines.push(LineInfo { line_index, + start_col, end_col: CharPos::from_usize(line_len) }); start_col = CharPos::from_usize(0); } // For the last line, it extends from `start_col` to `hi.col`: lines.push(LineInfo { line_index: hi.line - 1, - start_col: start_col, + start_col, end_col: hi.col }); Ok(FileLines {file: lo.file, lines: lines}) @@ -426,7 +426,7 @@ impl CodeMap { return Err(SpanSnippetError::MalformedForCodemap( MalformedCodemapPositions { name: local_begin.fm.name.clone(), - source_len: source_len, + source_len, begin_pos: local_begin.pos, end_pos: local_end.pos, })); @@ -581,7 +581,7 @@ impl FilePathMapping { pub fn new(mapping: Vec<(String, String)>) -> FilePathMapping { FilePathMapping { - mapping: mapping + mapping, } } diff --git a/src/libsyntax/config.rs b/src/libsyntax/config.rs index 54e6dde41e6..14f1f8fbf8c 100644 --- a/src/libsyntax/config.rs +++ b/src/libsyntax/config.rs @@ -32,8 +32,8 @@ pub fn features(mut krate: ast::Crate, sess: &ParseSess, should_test: bool) let features; { let mut strip_unconfigured = StripUnconfigured { - should_test: should_test, - sess: sess, + should_test, + sess, features: None, }; @@ -105,10 +105,10 @@ impl<'a> StripUnconfigured<'a> { self.process_cfg_attr(ast::Attribute { id: attr::mk_attr_id(), style: attr.style, - path: path, - tokens: tokens, + path, + tokens, is_sugared_doc: false, - span: span, + span, }) } else { None diff --git a/src/libsyntax/diagnostics/plugin.rs b/src/libsyntax/diagnostics/plugin.rs index 855f4cd3557..5224f52c496 100644 --- a/src/libsyntax/diagnostics/plugin.rs +++ b/src/libsyntax/diagnostics/plugin.rs @@ -133,7 +133,7 @@ pub fn expand_register_diagnostic<'cx>(ecx: &'cx mut ExtCtxt, // Add the error to the map. with_registered_diagnostics(|diagnostics| { let info = ErrorInfo { - description: description, + description, use_site: None }; if diagnostics.insert(code.name, info).is_some() { @@ -235,7 +235,7 @@ pub fn expand_build_diagnostic_array<'cx>(ecx: &'cx mut ExtCtxt, expr, ), vis: ast::Visibility::Public, - span: span, + span, tokens: None, }) ])) diff --git a/src/libsyntax/ext/base.rs b/src/libsyntax/ext/base.rs index 72b2552f64f..e57d9c6fe89 100644 --- a/src/libsyntax/ext/base.rs +++ b/src/libsyntax/ext/base.rs @@ -677,10 +677,10 @@ impl<'a> ExtCtxt<'a> { resolver: &'a mut Resolver) -> ExtCtxt<'a> { ExtCtxt { - parse_sess: parse_sess, - ecfg: ecfg, + parse_sess, + ecfg, crate_root: None, - resolver: resolver, + resolver, resolve_err_count: 0, current_expansion: ExpansionData { mark: Mark::root(), diff --git a/src/libsyntax/ext/build.rs b/src/libsyntax/ext/build.rs index de0538e38b3..cbdd0013593 100644 --- a/src/libsyntax/ext/build.rs +++ b/src/libsyntax/ext/build.rs @@ -366,7 +366,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { path.segments.push(ast::PathSegment { identifier: ident.node, span: ident.span, - parameters: parameters, + parameters, }); (ast::QSelf { @@ -377,15 +377,15 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn ty_mt(&self, ty: P, mutbl: ast::Mutability) -> ast::MutTy { ast::MutTy { - ty: ty, - mutbl: mutbl + ty, + mutbl, } } fn ty(&self, span: Span, ty: ast::TyKind) -> P { P(ast::Ty { id: ast::DUMMY_NODE_ID, - span: span, + span, node: ty }) } @@ -444,15 +444,15 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ident: id, id: ast::DUMMY_NODE_ID, attrs: attrs.into(), - bounds: bounds, - default: default, - span: span + bounds, + default, + span, } } fn trait_ref(&self, path: ast::Path) -> ast::TraitRef { ast::TraitRef { - path: path, + path, ref_id: ast::DUMMY_NODE_ID, } } @@ -461,7 +461,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::PolyTraitRef { bound_lifetimes: Vec::new(), trait_ref: self.trait_ref(path), - span: span, + span, } } @@ -482,7 +482,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::LifetimeDef { attrs: attrs.into(), lifetime: self.lifetime(span, ident), - bounds: bounds + bounds, } } @@ -511,7 +511,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.pat_ident(sp, ident) }; let local = P(ast::Local { - pat: pat, + pat, ty: None, init: Some(ex), id: ast::DUMMY_NODE_ID, @@ -539,7 +539,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { self.pat_ident(sp, ident) }; let local = P(ast::Local { - pat: pat, + pat, ty: Some(typ), init: Some(ex), id: ast::DUMMY_NODE_ID, @@ -560,13 +560,13 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ty: Some(ty), init: None, id: ast::DUMMY_NODE_ID, - span: span, + span, attrs: ast::ThinVec::new(), }); ast::Stmt { id: ast::DUMMY_NODE_ID, node: ast::StmtKind::Local(local), - span: span, + span, } } @@ -587,18 +587,18 @@ impl<'a> AstBuilder for ExtCtxt<'a> { } fn block(&self, span: Span, stmts: Vec) -> P { P(ast::Block { - stmts: stmts, + stmts, id: ast::DUMMY_NODE_ID, rules: BlockCheckMode::Default, - span: span, + span, }) } fn expr(&self, span: Span, node: ast::ExprKind) -> P { P(ast::Expr { id: ast::DUMMY_NODE_ID, - node: node, - span: span, + node, + span, attrs: ast::ThinVec::new(), }) } @@ -672,7 +672,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ast::Field { ident: respan(span, name), expr: e, - span: span, + span, is_shorthand: false, attrs: ast::ThinVec::new(), } @@ -876,7 +876,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn arm(&self, _span: Span, pats: Vec>, expr: P) -> ast::Arm { ast::Arm { attrs: vec![], - pats: pats, + pats, guard: None, body: expr } @@ -954,7 +954,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { fn arg(&self, span: Span, ident: ast::Ident, ty: P) -> ast::Arg { let arg_pat = self.pat_ident(span, ident); ast::Arg { - ty: ty, + ty, pat: arg_pat, id: ast::DUMMY_NODE_ID } @@ -963,7 +963,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { // FIXME unused self fn fn_decl(&self, inputs: Vec, output: P) -> P { P(ast::FnDecl { - inputs: inputs, + inputs, output: ast::FunctionRetTy::Ty(output), variadic: false }) @@ -975,11 +975,11 @@ impl<'a> AstBuilder for ExtCtxt<'a> { // Rust coding conventions P(ast::Item { ident: name, - attrs: attrs, + attrs, id: ast::DUMMY_NODE_ID, - node: node, + node, vis: ast::Visibility::Inherited, - span: span, + span, tokens: None, }) } @@ -1022,7 +1022,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { let fields: Vec<_> = tys.into_iter().map(|ty| { ast::StructField { span: ty.span, - ty: ty, + ty, ident: None, vis: ast::Visibility::Inherited, attrs: Vec::new(), @@ -1038,7 +1038,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { respan(span, ast::Variant_ { - name: name, + name, attrs: Vec::new(), data: vdata, disr_expr: None, @@ -1081,7 +1081,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { attrs, ast::ItemKind::Mod(ast::Mod { inner: inner_span, - items: items, + items, }) ) } @@ -1147,7 +1147,7 @@ impl<'a> AstBuilder for ExtCtxt<'a> { ident: keywords::Invalid.ident(), attrs: vec![], node: ast::ItemKind::Use(vp), - vis: vis, + vis, span: sp, tokens: None, }) diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 9625602fa4a..d1172b1b2ce 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -303,7 +303,7 @@ impl<'a, 'b> MacroExpander<'a, 'b> { kind: InvocationKind::Derive { path: path.clone(), item: item }, expansion_kind: invoc.expansion_kind, expansion_data: ExpansionData { - mark: mark, + mark, ..invoc.expansion_data.clone() }, }); @@ -579,7 +579,8 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let pretty_name = Symbol::intern(&format!("derive({})", path)); let span = path.span; let attr = ast::Attribute { - path: path, tokens: TokenStream::empty(), span: span, + path, span, + tokens: TokenStream::empty(), // irrelevant: id: ast::AttrId(0), style: ast::AttrStyle::Outer, is_sugared_doc: false, }; @@ -714,10 +715,10 @@ impl<'a, 'b> InvocationCollector<'a, 'b> { fn collect(&mut self, expansion_kind: ExpansionKind, kind: InvocationKind) -> Expansion { let mark = Mark::fresh(self.cx.current_expansion.mark); self.invocations.push(Invocation { - kind: kind, - expansion_kind: expansion_kind, + kind, + expansion_kind, expansion_data: ExpansionData { - mark: mark, + mark, depth: self.cx.current_expansion.depth + 1, ..self.cx.current_expansion.clone() }, @@ -876,7 +877,7 @@ impl<'a, 'b> Folder for InvocationCollector<'a, 'b> { item.and_then(|item| match item.node { ItemKind::Mac(mac) => { self.collect(ExpansionKind::Items, InvocationKind::Bang { - mac: mac, + mac, ident: Some(item.ident), span: item.span, }).make_items() @@ -1035,7 +1036,7 @@ macro_rules! feature_tests { impl<'feat> ExpansionConfig<'feat> { pub fn default(crate_name: String) -> ExpansionConfig<'static> { ExpansionConfig { - crate_name: crate_name, + crate_name, features: None, recursion_limit: 1024, trace_mac: false, diff --git a/src/libsyntax/ext/placeholders.rs b/src/libsyntax/ext/placeholders.rs index e3377c1d8de..4fc2b92d3cd 100644 --- a/src/libsyntax/ext/placeholders.rs +++ b/src/libsyntax/ext/placeholders.rs @@ -35,7 +35,7 @@ pub fn placeholder(kind: ExpansionKind, id: ast::NodeId) -> Expansion { let vis = ast::Visibility::Inherited; let span = DUMMY_SP; let expr_placeholder = || P(ast::Expr { - id: id, span: span, + id, span, attrs: ast::ThinVec::new(), node: ast::ExprKind::Mac(mac_placeholder()), }); @@ -44,30 +44,30 @@ pub fn placeholder(kind: ExpansionKind, id: ast::NodeId) -> Expansion { ExpansionKind::Expr => Expansion::Expr(expr_placeholder()), ExpansionKind::OptExpr => Expansion::OptExpr(Some(expr_placeholder())), ExpansionKind::Items => Expansion::Items(SmallVector::one(P(ast::Item { - id: id, span: span, ident: ident, vis: vis, attrs: attrs, + id, span, ident, vis, attrs, node: ast::ItemKind::Mac(mac_placeholder()), tokens: None, }))), ExpansionKind::TraitItems => Expansion::TraitItems(SmallVector::one(ast::TraitItem { - id: id, span: span, ident: ident, attrs: attrs, + id, span, ident, attrs, node: ast::TraitItemKind::Macro(mac_placeholder()), tokens: None, })), ExpansionKind::ImplItems => Expansion::ImplItems(SmallVector::one(ast::ImplItem { - id: id, span: span, ident: ident, vis: vis, attrs: attrs, + id, span, ident, vis, attrs, node: ast::ImplItemKind::Macro(mac_placeholder()), defaultness: ast::Defaultness::Final, tokens: None, })), ExpansionKind::Pat => Expansion::Pat(P(ast::Pat { - id: id, span: span, node: ast::PatKind::Mac(mac_placeholder()), + id, span, node: ast::PatKind::Mac(mac_placeholder()), })), ExpansionKind::Ty => Expansion::Ty(P(ast::Ty { - id: id, span: span, node: ast::TyKind::Mac(mac_placeholder()), + id, span, node: ast::TyKind::Mac(mac_placeholder()), })), ExpansionKind::Stmts => Expansion::Stmts(SmallVector::one({ let mac = P((mac_placeholder(), ast::MacStmtStyle::Braces, ast::ThinVec::new())); - ast::Stmt { id: id, span: span, node: ast::StmtKind::Mac(mac) } + ast::Stmt { id, span, node: ast::StmtKind::Mac(mac) } })), } } @@ -81,9 +81,9 @@ pub struct PlaceholderExpander<'a, 'b: 'a> { impl<'a, 'b> PlaceholderExpander<'a, 'b> { pub fn new(cx: &'a mut ExtCtxt<'b>, monotonic: bool) -> Self { PlaceholderExpander { - cx: cx, + cx, expansions: HashMap::new(), - monotonic: monotonic, + monotonic, } } diff --git a/src/libsyntax/ext/quote.rs b/src/libsyntax/ext/quote.rs index 9907dfe341e..c3f3a59c302 100644 --- a/src/libsyntax/ext/quote.rs +++ b/src/libsyntax/ext/quote.rs @@ -383,7 +383,7 @@ pub fn unflatten(tts: Vec) -> Vec { } TokenTree::Token(span, token::CloseDelim(delim)) => { let tree = TokenTree::Delimited(span, Delimited { - delim: delim, + delim, tts: result.into_iter().map(TokenStream::from).collect::().into(), }); result = results.pop().unwrap(); diff --git a/src/libsyntax/ext/tt/macro_parser.rs b/src/libsyntax/ext/tt/macro_parser.rs index 146bd5d9856..aea48632d5d 100644 --- a/src/libsyntax/ext/tt/macro_parser.rs +++ b/src/libsyntax/ext/tt/macro_parser.rs @@ -178,7 +178,7 @@ fn initial_matcher_pos(ms: Vec, lo: BytePos) -> Box { sep: None, idx: 0, up: None, - matches: matches, + matches, match_lo: 0, match_cur: 0, match_hi: match_idx_hi, @@ -374,7 +374,7 @@ fn inner_parse_loop(sess: &ParseSess, stack: vec![], sep: seq.separator.clone(), idx: 0, - matches: matches, + matches, match_lo: item.match_cur, match_cur: item.match_cur, match_hi: item.match_cur + seq.num_captures, @@ -400,7 +400,7 @@ fn inner_parse_loop(sess: &ParseSess, let idx = item.idx; item.stack.push(MatcherTtFrame { elts: lower_elts, - idx: idx, + idx, }); item.idx = 0; cur_items.push(item); diff --git a/src/libsyntax/ext/tt/macro_rules.rs b/src/libsyntax/ext/tt/macro_rules.rs index 7b3fe2bd993..983b19c5bf0 100644 --- a/src/libsyntax/ext/tt/macro_rules.rs +++ b/src/libsyntax/ext/tt/macro_rules.rs @@ -271,9 +271,9 @@ pub fn compile(sess: &ParseSess, features: &RefCell, def: &ast::Item) let expander: Box<_> = Box::new(MacroRulesMacroExpander { name: def.ident, - lhses: lhses, - rhses: rhses, - valid: valid, + lhses, + rhses, + valid, }); if body.legacy { diff --git a/src/libsyntax/ext/tt/quoted.rs b/src/libsyntax/ext/tt/quoted.rs index 6fdcadd1dde..012d4a54b36 100644 --- a/src/libsyntax/ext/tt/quoted.rs +++ b/src/libsyntax/ext/tt/quoted.rs @@ -191,8 +191,8 @@ fn parse_tree(tree: tokenstream::TokenTree, let name_captures = macro_parser::count_names(&sequence); TokenTree::Sequence(span, Rc::new(SequenceRepetition { tts: sequence, - separator: separator, - op: op, + separator, + op, num_captures: name_captures, })) } diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index 2b8a733b852..7b2a31b5705 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -1576,9 +1576,9 @@ pub fn check_crate(krate: &ast::Crate, unstable: UnstableFeatures) { maybe_stage_features(&sess.span_diagnostic, krate, unstable); let ctx = Context { - features: features, + features, parse_sess: sess, - plugin_attributes: plugin_attributes, + plugin_attributes, }; visit::walk_crate(&mut PostExpansionVisitor { context: &ctx }, krate); } diff --git a/src/libsyntax/fold.rs b/src/libsyntax/fold.rs index a54e2573af4..6fd0a2eab42 100644 --- a/src/libsyntax/fold.rs +++ b/src/libsyntax/fold.rs @@ -375,8 +375,8 @@ pub fn noop_fold_ty(t: P, fld: &mut T) -> P { TyKind::BareFn(f) => { TyKind::BareFn(f.map(|BareFnTy {lifetimes, unsafety, abi, decl}| BareFnTy { lifetimes: fld.fold_lifetime_defs(lifetimes), - unsafety: unsafety, - abi: abi, + unsafety, + abi, decl: fld.fold_fn_decl(decl) })) } @@ -387,7 +387,7 @@ pub fn noop_fold_ty(t: P, fld: &mut T) -> P { let qself = qself.map(|QSelf { ty, position }| { QSelf { ty: fld.fold_ty(ty), - position: position + position, } }); TyKind::Path(qself, fld.fold_path(path)) @@ -415,7 +415,7 @@ pub fn noop_fold_ty(t: P, fld: &mut T) -> P { pub fn noop_fold_foreign_mod(ForeignMod {abi, items}: ForeignMod, fld: &mut T) -> ForeignMod { ForeignMod { - abi: abi, + abi, items: items.move_map(|x| fld.fold_foreign_item(x)), } } @@ -658,7 +658,7 @@ pub fn noop_fold_fn_decl(decl: P, fld: &mut T) -> P { FunctionRetTy::Ty(ty) => FunctionRetTy::Ty(fld.fold_ty(ty)), FunctionRetTy::Default(span) => FunctionRetTy::Default(fld.new_span(span)), }, - variadic: variadic + variadic, }) } @@ -745,7 +745,7 @@ pub fn noop_fold_where_clause( predicates: predicates.move_map(|predicate| { fld.fold_where_predicate(predicate) }), - span: span, + span, } } @@ -846,7 +846,7 @@ pub fn noop_fold_field(f: Field, folder: &mut T) -> Field { pub fn noop_fold_mt(MutTy {ty, mutbl}: MutTy, folder: &mut T) -> MutTy { MutTy { ty: folder.fold_ty(ty), - mutbl: mutbl, + mutbl, } } @@ -864,7 +864,7 @@ pub fn noop_fold_block(b: P, folder: &mut T) -> P { b.map(|Block {id, stmts, rules, span}| Block { id: folder.new_id(id), stmts: stmts.move_flat_map(|s| folder.fold_stmt(s).into_iter()), - rules: rules, + rules, span: folder.new_span(span), }) } @@ -998,10 +998,10 @@ pub fn noop_fold_crate(Crate {module, attrs, span}: Crate, folder: &mut T) -> Crate { let mut items = folder.fold_item(P(ast::Item { ident: keywords::Invalid.ident(), - attrs: attrs, + attrs, id: ast::DUMMY_NODE_ID, vis: ast::Visibility::Public, - span: span, + span, node: ast::ItemKind::Mod(module), tokens: None, })).into_iter(); @@ -1024,9 +1024,9 @@ pub fn noop_fold_crate(Crate {module, attrs, span}: Crate, }; Crate { - module: module, - attrs: attrs, - span: span, + module, + attrs, + span, } } @@ -1048,7 +1048,7 @@ pub fn noop_fold_item_simple(Item {id, ident, attrs, node, vis, span, // FIXME: if this is replaced with a call to `folder.fold_tts` it causes // an ICE during resolve... odd! - tokens: tokens, + tokens, } } @@ -1264,7 +1264,7 @@ pub fn noop_fold_expr(Expr {id, node, span, attrs}: Expr, folder: &mu let qself = qself.map(|QSelf { ty, position }| { QSelf { ty: folder.fold_ty(ty), - position: position + position, } }); ExprKind::Path(qself, folder.fold_path(path)) diff --git a/src/libsyntax/json.rs b/src/libsyntax/json.rs index 695c740f405..19238c30670 100644 --- a/src/libsyntax/json.rs +++ b/src/libsyntax/json.rs @@ -42,7 +42,7 @@ impl JsonEmitter { code_map: Rc) -> JsonEmitter { JsonEmitter { dst: Box::new(io::stderr()), - registry: registry, + registry, cm: code_map, } } @@ -56,8 +56,8 @@ impl JsonEmitter { registry: Option, code_map: Rc) -> JsonEmitter { JsonEmitter { - dst: dst, - registry: registry, + dst, + registry, cm: code_map, } } @@ -251,7 +251,7 @@ impl DiagnosticSpan { Box::new(DiagnosticSpanMacroExpansion { span: call_site, macro_decl_name: bt.macro_decl_name, - def_site_span: def_site_span, + def_site_span, }) }); DiagnosticSpan { @@ -262,11 +262,11 @@ impl DiagnosticSpan { line_end: end.line, column_start: start.col.0 + 1, column_end: end.col.0 + 1, - is_primary: is_primary, + is_primary, text: DiagnosticSpanLine::from_span(span, je), suggested_replacement: suggestion.cloned(), expansion: backtrace_step, - label: label, + label, } } @@ -351,7 +351,7 @@ impl DiagnosticCode { DiagnosticCode { code: s, - explanation: explanation, + explanation, } }) } diff --git a/src/libsyntax/parse/attr.rs b/src/libsyntax/parse/attr.rs index c99a09ab24e..5dc5a53e279 100644 --- a/src/libsyntax/parse/attr.rs +++ b/src/libsyntax/parse/attr.rs @@ -141,11 +141,11 @@ impl<'a> Parser<'a> { Ok(ast::Attribute { id: attr::mk_attr_id(), - style: style, - path: path, - tokens: tokens, + style, + path, + tokens, is_sugared_doc: false, - span: span, + span, }) } diff --git a/src/libsyntax/parse/lexer/comments.rs b/src/libsyntax/parse/lexer/comments.rs index 8b545d3b909..f65fffebe33 100644 --- a/src/libsyntax/parse/lexer/comments.rs +++ b/src/libsyntax/parse/lexer/comments.rs @@ -192,7 +192,7 @@ fn read_line_comments(rdr: &mut StringReader, if !lines.is_empty() { comments.push(Comment { style: if code_to_the_left { Trailing } else { Isolated }, - lines: lines, + lines, pos: p, }); } @@ -306,8 +306,8 @@ fn read_block_comment(rdr: &mut StringReader, } debug!("<<< block comment"); comments.push(Comment { - style: style, - lines: lines, + style, + lines, pos: p, }); } diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 09cdf26bf1f..527d2e41396 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -160,18 +160,18 @@ impl<'a> StringReader<'a> { let source_text = (*filemap.src.as_ref().unwrap()).clone(); StringReader { - sess: sess, + sess, next_pos: filemap.start_pos, pos: filemap.start_pos, col: CharPos(0), ch: Some('\n'), - filemap: filemap, + filemap, terminator: None, save_new_lines_and_multibyte: true, // dummy values; not read peek_tok: token::Eof, peek_span: syntax_pos::DUMMY_SP, - source_text: source_text, + source_text, fatal_errs: Vec::new(), token: token::Eof, span: syntax_pos::DUMMY_SP, @@ -546,7 +546,7 @@ impl<'a> StringReader<'a> { }; Some(TokenAndSpan { - tok: tok, + tok, sp: self.mk_sp(start_bpos, self.pos), }) }) @@ -675,7 +675,7 @@ impl<'a> StringReader<'a> { }; Some(TokenAndSpan { - tok: tok, + tok, sp: self.mk_sp(start_bpos, self.pos), }) }) diff --git a/src/libsyntax/parse/lexer/tokentrees.rs b/src/libsyntax/parse/lexer/tokentrees.rs index 63a396c14db..ad389ab510a 100644 --- a/src/libsyntax/parse/lexer/tokentrees.rs +++ b/src/libsyntax/parse/lexer/tokentrees.rs @@ -114,7 +114,7 @@ impl<'a> StringReader<'a> { } Ok(TokenTree::Delimited(span, Delimited { - delim: delim, + delim, tts: tts.into(), })) }, diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 957164bab79..67b4954a8f1 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -69,7 +69,7 @@ impl ParseSess { config: HashSet::new(), missing_fragment_specifiers: RefCell::new(HashSet::new()), included_mod_stack: RefCell::new(vec![]), - code_map: code_map + code_map, } } diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 15f05df58b5..e251d136f23 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -465,17 +465,17 @@ impl From> for LhsExpr { /// Create a placeholder argument. fn dummy_arg(span: Span) -> Arg { let spanned = Spanned { - span: span, + span, node: keywords::Invalid.ident() }; let pat = P(Pat { id: ast::DUMMY_NODE_ID, node: PatKind::Ident(BindingMode::ByValue(Mutability::Immutable), spanned, None), - span: span + span, }); let ty = Ty { node: TyKind::Err, - span: span, + span, id: ast::DUMMY_NODE_ID }; Arg { ty: P(ty), pat: pat, id: ast::DUMMY_NODE_ID } @@ -489,7 +489,7 @@ impl<'a> Parser<'a> { desugar_doc_comments: bool) -> Self { let mut parser = Parser { - sess: sess, + sess, token: token::Underscore, span: syntax_pos::DUMMY_SP, prev_span: syntax_pos::DUMMY_SP, @@ -497,7 +497,7 @@ impl<'a> Parser<'a> { prev_token_kind: PrevTokenKind::Other, restrictions: Restrictions::empty(), obsolete_set: HashSet::new(), - recurse_into_file_modules: recurse_into_file_modules, + recurse_into_file_modules, directory: Directory { path: PathBuf::new(), ownership: DirectoryOwnership::Owned }, root_module_name: None, expected_tokens: Vec::new(), @@ -508,7 +508,7 @@ impl<'a> Parser<'a> { }), stack: Vec::new(), }, - desugar_doc_comments: desugar_doc_comments, + desugar_doc_comments, cfg_mods: true, }; @@ -1216,15 +1216,15 @@ impl<'a> Parser<'a> { let (inputs, variadic) = self.parse_fn_args(false, true)?; let ret_ty = self.parse_ret_ty()?; let decl = P(FnDecl { - inputs: inputs, + inputs, output: ret_ty, - variadic: variadic + variadic, }); Ok(TyKind::BareFn(P(BareFnTy { - abi: abi, - unsafety: unsafety, + abi, + unsafety, lifetimes: lifetime_defs, - decl: decl + decl, }))) } @@ -1312,11 +1312,11 @@ impl<'a> Parser<'a> { generics.where_clause = self.parse_where_clause()?; let sig = ast::MethodSig { - unsafety: unsafety, - constness: constness, + unsafety, + constness, decl: d, - generics: generics, - abi: abi, + generics, + abi, }; let body = match self.token { @@ -1344,8 +1344,8 @@ impl<'a> Parser<'a> { Ok(TraitItem { id: ast::DUMMY_NODE_ID, ident: name, - attrs: attrs, - node: node, + attrs, + node, span: lo.to(self.prev_span), tokens: None, }) @@ -1625,7 +1625,7 @@ impl<'a> Parser<'a> { Ok(Arg { ty: t, - pat: pat, + pat, id: ast::DUMMY_NODE_ID, }) } @@ -1649,7 +1649,7 @@ impl<'a> Parser<'a> { }; Ok(Arg { ty: t, - pat: pat, + pat, id: ast::DUMMY_NODE_ID }) } @@ -1934,8 +1934,8 @@ impl<'a> Parser<'a> { Ok(ast::Field { ident: respan(lo.to(hi), fieldname), span: lo.to(expr.span), - expr: expr, - is_shorthand: is_shorthand, + expr, + is_shorthand, attrs: attrs.into(), }) } @@ -1943,8 +1943,8 @@ impl<'a> Parser<'a> { pub fn mk_expr(&mut self, span: Span, node: ExprKind, attrs: ThinVec) -> P { P(Expr { id: ast::DUMMY_NODE_ID, - node: node, - span: span, + node, + span, attrs: attrs.into(), }) } @@ -1990,8 +1990,8 @@ impl<'a> Parser<'a> { P(Expr { id: ast::DUMMY_NODE_ID, node: ExprKind::Mac(codemap::Spanned {node: m, span: span}), - span: span, - attrs: attrs, + span, + attrs, }) } @@ -2006,7 +2006,7 @@ impl<'a> Parser<'a> { id: ast::DUMMY_NODE_ID, node: ExprKind::Lit(lv_lit), span: *span, - attrs: attrs, + attrs, }) } @@ -3153,9 +3153,9 @@ impl<'a> Parser<'a> { } Ok(ast::Arm { - attrs: attrs, - pats: pats, - guard: guard, + attrs, + pats, + guard, body: expr, }) } @@ -3361,7 +3361,7 @@ impl<'a> Parser<'a> { node: ast::FieldPat { ident: fieldname, pat: subpat, - is_shorthand: is_shorthand, + is_shorthand, attrs: attrs.into(), } }); @@ -3597,12 +3597,12 @@ impl<'a> Parser<'a> { }; let init = self.parse_initializer()?; Ok(P(ast::Local { - ty: ty, - pat: pat, - init: init, + ty, + pat, + init, id: ast::DUMMY_NODE_ID, span: lo.to(self.prev_span), - attrs: attrs, + attrs, })) } @@ -3618,10 +3618,10 @@ impl<'a> Parser<'a> { Ok(StructField { span: lo.to(self.prev_span), ident: Some(name), - vis: vis, + vis, id: ast::DUMMY_NODE_ID, - ty: ty, - attrs: attrs, + ty, + attrs, }) } @@ -3929,7 +3929,7 @@ impl<'a> Parser<'a> { Stmt { id: ast::DUMMY_NODE_ID, span: lo.to(hi), - node: node, + node, } } else { // if it has a special ident, it's definitely an item @@ -3946,7 +3946,7 @@ impl<'a> Parser<'a> { let span = lo.to(hi); Stmt { id: ast::DUMMY_NODE_ID, - span: span, + span, node: StmtKind::Item({ self.mk_item( span, id /*id is good here*/, @@ -4083,7 +4083,7 @@ impl<'a> Parser<'a> { } Ok(P(ast::Block { - stmts: stmts, + stmts, id: ast::DUMMY_NODE_ID, rules: s, span: lo.to(self.prev_span), @@ -4227,11 +4227,11 @@ impl<'a> Parser<'a> { Ok(TyParam { attrs: preceding_attrs.into(), - ident: ident, + ident, id: ast::DUMMY_NODE_ID, - bounds: bounds, - default: default, - span: span, + bounds, + default, + span, }) } @@ -4253,8 +4253,8 @@ impl<'a> Parser<'a> { }; lifetime_defs.push(LifetimeDef { attrs: attrs.into(), - lifetime: lifetime, - bounds: bounds, + lifetime, + bounds, }); if seen_ty_param { self.span_err(self.prev_span, @@ -4297,7 +4297,7 @@ impl<'a> Parser<'a> { self.expect_gt()?; Ok(ast::Generics { lifetimes: lifetime_defs, - ty_params: ty_params, + ty_params, where_clause: WhereClause { id: ast::DUMMY_NODE_ID, predicates: Vec::new(), @@ -4334,8 +4334,8 @@ impl<'a> Parser<'a> { let ty = self.parse_ty()?; bindings.push(TypeBinding { id: ast::DUMMY_NODE_ID, - ident: ident, - ty: ty, + ident, + ty, span: lo.to(self.prev_span), }); seen_binding = true; @@ -4404,8 +4404,8 @@ impl<'a> Parser<'a> { where_clause.predicates.push(ast::WherePredicate::RegionPredicate( ast::WhereRegionPredicate { span: lo.to(self.prev_span), - lifetime: lifetime, - bounds: bounds, + lifetime, + bounds, } )); } else if self.check_type() { @@ -4427,7 +4427,7 @@ impl<'a> Parser<'a> { span: lo.to(self.prev_span), bound_lifetimes: lifetime_defs, bounded_ty: ty, - bounds: bounds, + bounds, } )); // FIXME: Decide what should be used here, `=` or `==`. @@ -4437,7 +4437,7 @@ impl<'a> Parser<'a> { ast::WhereEqPredicate { span: lo.to(self.prev_span), lhs_ty: ty, - rhs_ty: rhs_ty, + rhs_ty, id: ast::DUMMY_NODE_ID, } )); @@ -4518,7 +4518,7 @@ impl<'a> Parser<'a> { Ok(P(FnDecl { inputs: args, output: ret_ty, - variadic: variadic + variadic, })) } @@ -4679,7 +4679,7 @@ impl<'a> Parser<'a> { Ok(P(FnDecl { inputs: inputs_captures, - output: output, + output, variadic: false })) } @@ -4694,12 +4694,12 @@ impl<'a> Parser<'a> { fn mk_item(&mut self, span: Span, ident: Ident, node: ItemKind, vis: Visibility, attrs: Vec) -> P { P(Item { - ident: ident, - attrs: attrs, + ident, + attrs, id: ast::DUMMY_NODE_ID, - node: node, - vis: vis, - span: span, + node, + vis, + span, tokens: None, }) } @@ -4799,10 +4799,10 @@ impl<'a> Parser<'a> { id: ast::DUMMY_NODE_ID, span: lo.to(self.prev_span), ident: name, - vis: vis, - defaultness: defaultness, - attrs: attrs, - node: node, + vis, + defaultness, + attrs, + node, tokens: None, }) } @@ -4896,11 +4896,11 @@ impl<'a> Parser<'a> { *at_end = true; let (inner_attrs, body) = self.parse_inner_attrs_and_block()?; Ok((ident, inner_attrs, ast::ImplItemKind::Method(ast::MethodSig { - generics: generics, - abi: abi, - unsafety: unsafety, - constness: constness, - decl: decl + generics, + abi, + unsafety, + constness, + decl, }, body))) } } @@ -5151,11 +5151,11 @@ impl<'a> Parser<'a> { let ty = p.parse_ty()?; Ok(StructField { span: lo.to(p.span), - vis: vis, + vis, ident: None, id: ast::DUMMY_NODE_ID, - ty: ty, - attrs: attrs, + ty, + attrs, }) })?; @@ -5281,7 +5281,7 @@ impl<'a> Parser<'a> { Ok(ast::Mod { inner: inner_lo.to(hi), - items: items + items, }) } @@ -5403,7 +5403,7 @@ impl<'a> Parser<'a> { ModulePath { name: mod_name, path_exists: default_exists || secondary_exists, - result: result, + result, } } @@ -5418,7 +5418,7 @@ impl<'a> Parser<'a> { Some("mod.rs") => DirectoryOwnership::Owned, _ => DirectoryOwnership::UnownedViaMod(true), }, - path: path, + path, warn: false, }); } @@ -5509,12 +5509,12 @@ impl<'a> Parser<'a> { let hi = self.span; self.expect(&token::Semi)?; Ok(ast::ForeignItem { - ident: ident, - attrs: attrs, + ident, + attrs, node: ForeignItemKind::Fn(decl, generics), id: ast::DUMMY_NODE_ID, span: lo.to(hi), - vis: vis + vis, }) } @@ -5529,12 +5529,12 @@ impl<'a> Parser<'a> { let hi = self.span; self.expect(&token::Semi)?; Ok(ForeignItem { - ident: ident, - attrs: attrs, + ident, + attrs, node: ForeignItemKind::Static(ty, mutbl), id: ast::DUMMY_NODE_ID, span: lo.to(hi), - vis: vis + vis, }) } @@ -5596,7 +5596,7 @@ impl<'a> Parser<'a> { let prev_span = self.prev_span; let m = ast::ForeignMod { - abi: abi, + abi, items: foreign_items }; let invalid = keywords::Invalid.ident(); @@ -5647,7 +5647,7 @@ impl<'a> Parser<'a> { name: ident, attrs: variant_attrs, data: struct_def, - disr_expr: disr_expr, + disr_expr, }; variants.push(respan(vlo.to(self.prev_span), vr)); @@ -6162,7 +6162,7 @@ impl<'a> Parser<'a> { let rename = this.parse_rename()?; let node = ast::PathListItem_ { name: ident, - rename: rename, + rename, id: ast::DUMMY_NODE_ID }; Ok(respan(lo.to(this.prev_span), node)) diff --git a/src/libsyntax/print/pp.rs b/src/libsyntax/print/pp.rs index 3ce9e9d07b3..5c4bf47a6db 100644 --- a/src/libsyntax/print/pp.rs +++ b/src/libsyntax/print/pp.rs @@ -246,7 +246,7 @@ pub fn mk_printer<'a>(out: Box, linewidth: usize) -> Printer<'a> { let n: usize = 55 * linewidth; debug!("mk_printer {}", linewidth); Printer { - out: out, + out, buf_len: n, margin: linewidth as isize, space: linewidth as isize, diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index e9d11e73837..3be831e828c 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -72,7 +72,7 @@ fn rust_printer<'a>(writer: Box, ann: &'a PpAnn) -> State<'a> { literals: vec![].into_iter().peekable(), cur_cmnt: 0, boxes: Vec::new(), - ann: ann, + ann, } } @@ -145,11 +145,11 @@ impl<'a> State<'a> { State { s: pp::mk_printer(out, DEFAULT_COLUMNS), cm: Some(cm), - comments: comments, + comments, literals: literals.unwrap_or_default().into_iter().peekable(), cur_cmnt: 0, boxes: Vec::new(), - ann: ann, + ann, } } } diff --git a/src/libsyntax/show_span.rs b/src/libsyntax/show_span.rs index 263a4f13c1b..8ab2ba71ec1 100644 --- a/src/libsyntax/show_span.rs +++ b/src/libsyntax/show_span.rs @@ -79,8 +79,8 @@ pub fn run(span_diagnostic: &errors::Handler, None => return }; let mut v = ShowSpanVisitor { - span_diagnostic: span_diagnostic, - mode: mode, + span_diagnostic, + mode, }; visit::walk_crate(&mut v, krate); } diff --git a/src/libsyntax/std_inject.rs b/src/libsyntax/std_inject.rs index 430976e7d3c..8977d701e5a 100644 --- a/src/libsyntax/std_inject.rs +++ b/src/libsyntax/std_inject.rs @@ -72,18 +72,18 @@ pub fn maybe_inject_crates_ref(mut krate: ast::Crate, alt_std_name: Option P { }; P(ast::Item { id: ast::DUMMY_NODE_ID, - ident: ident, + ident, node: vi, attrs: vec![], - vis: vis, + vis, span: sp, tokens: None, }) diff --git a/src/libsyntax_ext/asm.rs b/src/libsyntax_ext/asm.rs index 923e8072f43..3742fb8c804 100644 --- a/src/libsyntax_ext/asm.rs +++ b/src/libsyntax_ext/asm.rs @@ -152,8 +152,8 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, outputs.push(ast::InlineAsmOutput { constraint: output.unwrap_or(constraint), expr: out, - is_rw: is_rw, - is_indirect: is_indirect, + is_rw, + is_indirect, }); } } @@ -242,14 +242,14 @@ pub fn expand_asm<'cx>(cx: &'cx mut ExtCtxt, MacEager::expr(P(ast::Expr { id: ast::DUMMY_NODE_ID, node: ast::ExprKind::InlineAsm(P(ast::InlineAsm { - asm: asm, + asm, asm_str_style: asm_str_style.unwrap(), - outputs: outputs, - inputs: inputs, + outputs, + inputs, clobbers: clobs, - volatile: volatile, - alignstack: alignstack, - dialect: dialect, + volatile, + alignstack, + dialect, ctxt: cx.backtrace(), })), span: sp, diff --git a/src/libsyntax_ext/deriving/bounds.rs b/src/libsyntax_ext/deriving/bounds.rs index efb2fe5eb3b..0bc802283fb 100644 --- a/src/libsyntax_ext/deriving/bounds.rs +++ b/src/libsyntax_ext/deriving/bounds.rs @@ -34,9 +34,9 @@ pub fn expand_deriving_copy(cx: &mut ExtCtxt, let path = Path::new(v); let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), - path: path, + path, additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/clone.rs b/src/libsyntax_ext/deriving/clone.rs index 35a2a2513f4..71dd7abfab0 100644 --- a/src/libsyntax_ext/deriving/clone.rs +++ b/src/libsyntax_ext/deriving/clone.rs @@ -77,7 +77,7 @@ pub fn expand_deriving_clone(cx: &mut ExtCtxt, let inline = cx.meta_word(span, Symbol::intern("inline")); let attrs = vec![cx.attribute(span, inline)]; let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::clone::Clone), additional_bounds: bounds, diff --git a/src/libsyntax_ext/deriving/cmp/eq.rs b/src/libsyntax_ext/deriving/cmp/eq.rs index eef21492deb..0b57beeae85 100644 --- a/src/libsyntax_ext/deriving/cmp/eq.rs +++ b/src/libsyntax_ext/deriving/cmp/eq.rs @@ -28,7 +28,7 @@ pub fn expand_deriving_eq(cx: &mut ExtCtxt, let doc = cx.meta_list(span, Symbol::intern("doc"), vec![hidden]); let attrs = vec![cx.attribute(span, inline), cx.attribute(span, doc)]; let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::cmp::Eq), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/cmp/ord.rs b/src/libsyntax_ext/deriving/cmp/ord.rs index 9fc3d997585..9b057aacece 100644 --- a/src/libsyntax_ext/deriving/cmp/ord.rs +++ b/src/libsyntax_ext/deriving/cmp/ord.rs @@ -26,7 +26,7 @@ pub fn expand_deriving_ord(cx: &mut ExtCtxt, let inline = cx.meta_word(span, Symbol::intern("inline")); let attrs = vec![cx.attribute(span, inline)]; let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::cmp::Ord), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/cmp/partial_eq.rs b/src/libsyntax_ext/deriving/cmp/partial_eq.rs index f2a050ce971..e635c6bebcd 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_eq.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_eq.rs @@ -91,14 +91,14 @@ pub fn expand_deriving_partial_eq(cx: &mut ExtCtxt, } let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::cmp::PartialEq), additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, supports_unions: false, - methods: methods, + methods, associated_types: Vec::new(), }; trait_def.expand(cx, mitem, item, push) diff --git a/src/libsyntax_ext/deriving/cmp/partial_ord.rs b/src/libsyntax_ext/deriving/cmp/partial_ord.rs index ce4d549d696..e7e1c108760 100644 --- a/src/libsyntax_ext/deriving/cmp/partial_ord.rs +++ b/src/libsyntax_ext/deriving/cmp/partial_ord.rs @@ -59,7 +59,7 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt, generics: LifetimeBounds::empty(), explicit_self: borrowed_explicit_self(), args: vec![borrowed_self()], - ret_ty: ret_ty, + ret_ty, attributes: attrs, is_unsafe: false, unify_fieldless_variants: true, @@ -82,14 +82,14 @@ pub fn expand_deriving_partial_ord(cx: &mut ExtCtxt, }; let trait_def = TraitDef { - span: span, + span, attributes: vec![], path: path_std!(cx, core::cmp::PartialOrd), additional_bounds: vec![], generics: LifetimeBounds::empty(), is_unsafe: false, supports_unions: false, - methods: methods, + methods, associated_types: Vec::new(), }; trait_def.expand(cx, mitem, item, push) diff --git a/src/libsyntax_ext/deriving/debug.rs b/src/libsyntax_ext/deriving/debug.rs index 38ed596098b..54d71dd4b48 100644 --- a/src/libsyntax_ext/deriving/debug.rs +++ b/src/libsyntax_ext/deriving/debug.rs @@ -28,7 +28,7 @@ pub fn expand_deriving_debug(cx: &mut ExtCtxt, Borrowed(None, ast::Mutability::Mutable)); let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::fmt::Debug), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/decodable.rs b/src/libsyntax_ext/deriving/decodable.rs index 498f2348b80..517221af1d4 100644 --- a/src/libsyntax_ext/deriving/decodable.rs +++ b/src/libsyntax_ext/deriving/decodable.rs @@ -57,7 +57,7 @@ fn expand_deriving_decodable_imp(cx: &mut ExtCtxt, let typaram = &*deriving::hygienic_type_parameter(item, "__D"); let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: Path::new_(vec![krate, "Decodable"], None, vec![], true), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/default.rs b/src/libsyntax_ext/deriving/default.rs index 69391f48c22..0c8e3c39395 100644 --- a/src/libsyntax_ext/deriving/default.rs +++ b/src/libsyntax_ext/deriving/default.rs @@ -26,7 +26,7 @@ pub fn expand_deriving_default(cx: &mut ExtCtxt, let inline = cx.meta_word(span, Symbol::intern("inline")); let attrs = vec![cx.attribute(span, inline)]; let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: path_std!(cx, core::default::Default), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/encodable.rs b/src/libsyntax_ext/deriving/encodable.rs index 1e19cd99419..c2c862f043f 100644 --- a/src/libsyntax_ext/deriving/encodable.rs +++ b/src/libsyntax_ext/deriving/encodable.rs @@ -138,7 +138,7 @@ fn expand_deriving_encodable_imp(cx: &mut ExtCtxt, let typaram = &*deriving::hygienic_type_parameter(item, "__S"); let trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), path: Path::new_(vec![krate, "Encodable"], None, vec![], true), additional_bounds: Vec::new(), diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index 3cbc7938bde..674facd05fd 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -381,10 +381,10 @@ fn find_type_parameters(ty: &ast::Ty, } let mut visitor = Visitor { - ty_param_names: ty_param_names, + ty_param_names, types: Vec::new(), - span: span, - cx: cx, + span, + cx, }; visit::Visitor::visit_ty(&mut visitor, ty); @@ -499,7 +499,7 @@ impl<'a> TraitDef<'a> { ast::ImplItem { id: ast::DUMMY_NODE_ID, span: self.span, - ident: ident, + ident, vis: ast::Visibility::Inherited, defaultness: ast::Defaultness::Final, attrs: Vec::new(), @@ -596,7 +596,7 @@ impl<'a> TraitDef<'a> { span: self.span, bound_lifetimes: vec![], bounded_ty: ty, - bounds: bounds, + bounds, }; let predicate = ast::WherePredicate::BoundPredicate(predicate); @@ -606,10 +606,10 @@ impl<'a> TraitDef<'a> { } let trait_generics = Generics { - lifetimes: lifetimes, - ty_params: ty_params, - where_clause: where_clause, - span: span, + lifetimes, + ty_params, + where_clause, + span, }; // Create the reference to the trait. @@ -807,11 +807,11 @@ impl<'a> MethodDef<'a> { fields: &SubstructureFields) -> P { let substructure = Substructure { - type_ident: type_ident, + type_ident, method_ident: cx.ident_of(self.name), - self_args: self_args, - nonself_args: nonself_args, - fields: fields, + self_args, + nonself_args, + fields, }; let mut f = self.combine_substructure.borrow_mut(); let f: &mut CombineSubstructureFunc = &mut *f; @@ -924,8 +924,8 @@ impl<'a> MethodDef<'a> { ident: method_ident, node: ast::ImplItemKind::Method(ast::MethodSig { generics: fn_generics, - abi: abi, - unsafety: unsafety, + abi, + unsafety, constness: dummy_spanned(ast::Constness::NotConst), decl: fn_decl, @@ -985,7 +985,7 @@ impl<'a> MethodDef<'a> { let mut other_fields: Vec> = raw_fields.collect(); first_field.map(|(span, opt_id, field, attrs)| { FieldInfo { - span: span, + span, name: opt_id, self_: field, other: other_fields.iter_mut() @@ -995,7 +995,7 @@ impl<'a> MethodDef<'a> { } }) .collect(), - attrs: attrs, + attrs, } }) .collect() @@ -1246,7 +1246,7 @@ impl<'a> MethodDef<'a> { name: opt_ident, self_: self_getter_expr, other: others, - attrs: attrs, + attrs, } }).collect::>(); @@ -1553,7 +1553,7 @@ impl<'a> TraitDef<'a> { span: Span { ctxt: self.span.ctxt, ..pat.span }, node: ast::FieldPat { ident: ident.unwrap(), - pat: pat, + pat, is_shorthand: false, attrs: ast::ThinVec::new(), }, diff --git a/src/libsyntax_ext/deriving/generic/ty.rs b/src/libsyntax_ext/deriving/generic/ty.rs index f5ac1743920..47b5f40832a 100644 --- a/src/libsyntax_ext/deriving/generic/ty.rs +++ b/src/libsyntax_ext/deriving/generic/ty.rs @@ -55,10 +55,10 @@ impl<'a> Path<'a> { global: bool) -> Path<'r> { Path { - path: path, - lifetime: lifetime, - params: params, - global: global, + path, + lifetime, + params, + global, } } @@ -211,14 +211,14 @@ fn mk_ty_param(cx: &ExtCtxt, fn mk_generics(lifetimes: Vec, ty_params: Vec, span: Span) -> Generics { Generics { - lifetimes: lifetimes, - ty_params: ty_params, + lifetimes, + ty_params, where_clause: ast::WhereClause { id: ast::DUMMY_NODE_ID, predicates: Vec::new(), - span: span, + span, }, - span: span, + span, } } diff --git a/src/libsyntax_ext/deriving/hash.rs b/src/libsyntax_ext/deriving/hash.rs index a341c21d0a1..6c78eea186d 100644 --- a/src/libsyntax_ext/deriving/hash.rs +++ b/src/libsyntax_ext/deriving/hash.rs @@ -30,9 +30,9 @@ pub fn expand_deriving_hash(cx: &mut ExtCtxt, let arg = Path::new_local(typaram); let hash_trait_def = TraitDef { - span: span, + span, attributes: Vec::new(), - path: path, + path, additional_bounds: Vec::new(), generics: LifetimeBounds::empty(), is_unsafe: false, diff --git a/src/libsyntax_ext/deriving/mod.rs b/src/libsyntax_ext/deriving/mod.rs index 00dcfc7a587..cd706f14a68 100644 --- a/src/libsyntax_ext/deriving/mod.rs +++ b/src/libsyntax_ext/deriving/mod.rs @@ -173,6 +173,6 @@ fn call_intrinsic(cx: &ExtCtxt, stmts: vec![cx.stmt_expr(call)], id: ast::DUMMY_NODE_ID, rules: ast::BlockCheckMode::Unsafe(ast::CompilerGenerated), - span: span, + span, })) } diff --git a/src/libsyntax_ext/format.rs b/src/libsyntax_ext/format.rs index 16b06424c92..764cedfcf20 100644 --- a/src/libsyntax_ext/format.rs +++ b/src/libsyntax_ext/format.rs @@ -709,11 +709,11 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, }; let mut cx = Context { - ecx: ecx, - args: args, - arg_types: arg_types, - arg_unique_types: arg_unique_types, - names: names, + ecx, + args, + arg_types, + arg_unique_types, + names, curarg: 0, arg_index_map: Vec::new(), count_args: Vec::new(), @@ -724,7 +724,7 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt, pieces: Vec::new(), str_pieces: Vec::new(), all_pieces_simple: true, - macsp: macsp, + macsp, fmtsp: fmt.span, }; diff --git a/src/libsyntax_ext/format_foreign.rs b/src/libsyntax_ext/format_foreign.rs index 3c802e8334d..99dae29d606 100644 --- a/src/libsyntax_ext/format_foreign.rs +++ b/src/libsyntax_ext/format_foreign.rs @@ -265,7 +265,7 @@ pub mod printf { /// Returns an iterator over all substitutions in a given string. pub fn iter_subs(s: &str) -> Substitutions { Substitutions { - s: s, + s, } } @@ -553,12 +553,12 @@ pub mod printf { let f = Format { span: start.slice_between(end).unwrap(), - parameter: parameter, - flags: flags, - width: width, - precision: precision, - length: length, - type_: type_, + parameter, + flags, + width, + precision, + length, + type_, }; Some((Substitution::Format(f), end.slice_after())) } @@ -776,7 +776,7 @@ pub mod shell { /// Returns an iterator over all substitutions in a given string. pub fn iter_subs(s: &str) -> Substitutions { Substitutions { - s: s, + s, } } @@ -933,7 +933,7 @@ mod strcursor { impl<'a> StrCursor<'a> { pub fn new_at_start(s: &'a str) -> StrCursor<'a> { StrCursor { - s: s, + s, at: 0, } } diff --git a/src/libsyntax_ext/global_asm.rs b/src/libsyntax_ext/global_asm.rs index 8b0bb8cb891..81226ba599a 100644 --- a/src/libsyntax_ext/global_asm.rs +++ b/src/libsyntax_ext/global_asm.rs @@ -56,7 +56,7 @@ pub fn expand_global_asm<'cx>(cx: &'cx mut ExtCtxt, attrs: Vec::new(), id: ast::DUMMY_NODE_ID, node: ast::ItemKind::GlobalAsm(P(ast::GlobalAsm { - asm: asm, + asm, ctxt: cx.backtrace(), })), vis: ast::Visibility::Inherited, diff --git a/src/libsyntax_ext/proc_macro_registrar.rs b/src/libsyntax_ext/proc_macro_registrar.rs index 700386f68fe..a8a54a97ac3 100644 --- a/src/libsyntax_ext/proc_macro_registrar.rs +++ b/src/libsyntax_ext/proc_macro_registrar.rs @@ -69,9 +69,9 @@ pub fn modify(sess: &ParseSess, attr_macros: Vec::new(), bang_macros: Vec::new(), in_root: true, - handler: handler, - is_proc_macro_crate: is_proc_macro_crate, - is_test_crate: is_test_crate, + handler, + is_proc_macro_crate, + is_test_crate, }; visit::walk_crate(&mut collect, &krate); (collect.derives, collect.attr_macros, collect.bang_macros) @@ -183,7 +183,7 @@ impl<'a> CollectProcMacros<'a> { if self.in_root && item.vis == ast::Visibility::Public { self.derives.push(ProcMacroDerive { span: item.span, - trait_name: trait_name, + trait_name, function_name: item.ident, attrs: proc_attrs, }); diff --git a/src/libsyntax_pos/hygiene.rs b/src/libsyntax_pos/hygiene.rs index 514cc26666e..296a3b11aed 100644 --- a/src/libsyntax_pos/hygiene.rs +++ b/src/libsyntax_pos/hygiene.rs @@ -161,7 +161,7 @@ impl SyntaxContext { syntax_contexts.push(SyntaxContextData { outer_mark: mark, prev_ctxt: self, - modern: modern, + modern, }); SyntaxContext(syntax_contexts.len() as u32 - 1) }) diff --git a/src/libsyntax_pos/lib.rs b/src/libsyntax_pos/lib.rs index e162bc26412..f5449061b87 100644 --- a/src/libsyntax_pos/lib.rs +++ b/src/libsyntax_pos/lib.rs @@ -184,8 +184,8 @@ impl Span { if !info.call_site.source_equal(&prev_span) { result.push(MacroBacktrace { call_site: info.call_site, - macro_decl_name: macro_decl_name, - def_site_span: def_site_span, + macro_decl_name, + def_site_span, }); } @@ -358,7 +358,7 @@ impl MultiSpan { for &(span, ref label) in &self.span_labels { span_labels.push(SpanLabel { - span: span, + span, is_primary: is_primary(span), label: Some(label.clone()) }); @@ -367,7 +367,7 @@ impl MultiSpan { for &span in &self.primary_spans { if !span_labels.iter().any(|sl| sl.span == span) { span_labels.push(SpanLabel { - span: span, + span, is_primary: true, label: None }); @@ -556,16 +556,16 @@ impl Decodable for FileMap { let multibyte_chars: Vec = d.read_struct_field("multibyte_chars", 5, |d| Decodable::decode(d))?; Ok(FileMap { - name: name, - name_was_remapped: name_was_remapped, + name, + name_was_remapped, // `crate_of_origin` has to be set by the importer. // This value matches up with rustc::hir::def_id::INVALID_CRATE. // That constant is not available here unfortunately :( crate_of_origin: ::std::u32::MAX - 1, - start_pos: start_pos, - end_pos: end_pos, + start_pos, + end_pos, src: None, - src_hash: src_hash, + src_hash, external_src: RefCell::new(ExternalSource::AbsentOk), lines: RefCell::new(lines), multibyte_chars: RefCell::new(multibyte_chars) @@ -594,13 +594,13 @@ impl FileMap { let end_pos = start_pos.to_usize() + src.len(); FileMap { - name: name, - name_was_remapped: name_was_remapped, + name, + name_was_remapped, crate_of_origin: 0, src: Some(Rc::new(src)), - src_hash: src_hash, + src_hash, external_src: RefCell::new(ExternalSource::Unneeded), - start_pos: start_pos, + start_pos, end_pos: Pos::from_usize(end_pos), lines: RefCell::new(Vec::new()), multibyte_chars: RefCell::new(Vec::new()), @@ -687,8 +687,8 @@ impl FileMap { pub fn record_multibyte_char(&self, pos: BytePos, bytes: usize) { assert!(bytes >=2 && bytes <= 4); let mbc = MultiByteChar { - pos: pos, - bytes: bytes, + pos, + bytes, }; self.multibyte_chars.borrow_mut().push(mbc); } diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs index 68cfc7033ef..c5e68eed407 100644 --- a/src/libterm/terminfo/mod.rs +++ b/src/libterm/terminfo/mod.rs @@ -231,7 +231,7 @@ impl TerminfoTerminal { }; TerminfoTerminal { - out: out, + out, ti: terminfo, num_colors: nc, } diff --git a/src/libterm/terminfo/parser/compiled.rs b/src/libterm/terminfo/parser/compiled.rs index 8d1ba378521..0cdea64db8b 100644 --- a/src/libterm/terminfo/parser/compiled.rs +++ b/src/libterm/terminfo/parser/compiled.rs @@ -337,8 +337,8 @@ pub fn msys_terminfo() -> TermInfo { TermInfo { names: vec!["cygwin".to_string()], // msys is a fork of an older cygwin version bools: HashMap::new(), - numbers: numbers, - strings: strings, + numbers, + strings, } } diff --git a/src/libtest/lib.rs b/src/libtest/lib.rs index bf71b11fc77..5451ec24aa8 100644 --- a/src/libtest/lib.rs +++ b/src/libtest/lib.rs @@ -235,8 +235,8 @@ pub struct Metric { impl Metric { pub fn new(value: f64, noise: f64) -> Metric { Metric { - value: value, - noise: noise, + value, + noise, } } } @@ -492,17 +492,17 @@ pub fn parse_opts(args: &[String]) -> Option { }; let test_opts = TestOpts { - list: list, - filter: filter, + list, + filter, filter_exact: exact, - run_ignored: run_ignored, - run_tests: run_tests, - bench_benchmarks: bench_benchmarks, - logfile: logfile, - nocapture: nocapture, - color: color, - quiet: quiet, - test_threads: test_threads, + run_ignored, + run_tests, + bench_benchmarks, + logfile, + nocapture, + color, + quiet, + test_threads, skip: matches.opt_strs("skip"), options: Options::new(), }; @@ -565,8 +565,8 @@ impl ConsoleTestState { }; Ok(ConsoleTestState { - out: out, - log_out: log_out, + out, + log_out, use_color: use_color(opts), quiet: opts.quiet, total: 0, @@ -1330,7 +1330,7 @@ pub fn filter_tests(opts: &TestOpts, tests: Vec) -> Vec) -> Vec, msg); Some((which, Error { - line_num: line_num, - kind: kind, - msg: msg, + line_num, + kind, + msg, })) } diff --git a/src/tools/compiletest/src/json.rs b/src/tools/compiletest/src/json.rs index 23782c3ccc9..77ee93c3007 100644 --- a/src/tools/compiletest/src/json.rs +++ b/src/tools/compiletest/src/json.rs @@ -148,8 +148,8 @@ fn push_expected_errors(expected_errors: &mut Vec, let kind = ErrorKind::from_str(&diagnostic.level).ok(); expected_errors.push(Error { line_num: span.line_start, - kind: kind, - msg: msg, + kind, + msg, }); } } diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs index 6fa758aeabe..384ae3f45f6 100644 --- a/src/tools/compiletest/src/main.rs +++ b/src/tools/compiletest/src/main.rs @@ -176,9 +176,9 @@ pub fn parse_config(args: Vec ) -> Config { target_rustcflags: matches.opt_str("target-rustcflags"), target: opt_str2(matches.opt_str("target")), host: opt_str2(matches.opt_str("host")), - gdb: gdb, - gdb_version: gdb_version, - gdb_native_rust: gdb_native_rust, + gdb, + gdb_version, + gdb_native_rust, lldb_version: extract_lldb_version(matches.opt_str("lldb-version")), llvm_version: matches.opt_str("llvm-version"), system_llvm: matches.opt_present("system-llvm"), @@ -192,7 +192,7 @@ pub fn parse_config(args: Vec ) -> Config { lldb_python_dir: matches.opt_str("lldb-python-dir"), verbose: matches.opt_present("verbose"), quiet: matches.opt_present("quiet"), - color: color, + color, remote_test_client: matches.opt_str("remote-test-client").map(PathBuf::from), cc: matches.opt_str("cc").unwrap(), @@ -470,8 +470,8 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn test::TestDescAndFn { desc: test::TestDesc { name: make_test_name(config, testpaths), - ignore: ignore, - should_panic: should_panic, + ignore, + should_panic, allow_fail: false, }, testfn: make_test_closure(config, testpaths), diff --git a/src/tools/compiletest/src/procsrv.rs b/src/tools/compiletest/src/procsrv.rs index b6d89c1f51a..ffcc60e7852 100644 --- a/src/tools/compiletest/src/procsrv.rs +++ b/src/tools/compiletest/src/procsrv.rs @@ -97,7 +97,7 @@ pub fn run(lib_path: &str, let Output { status, stdout, stderr } = process.wait_with_output().unwrap(); Ok(Result { - status: status, + status, out: String::from_utf8(stdout).unwrap(), err: String::from_utf8(stderr).unwrap(), }) diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs index 769748c63c0..02511ac6d98 100644 --- a/src/tools/compiletest/src/runtest.rs +++ b/src/tools/compiletest/src/runtest.rs @@ -59,7 +59,7 @@ pub fn run(config: Config, testpaths: &TestPaths) { let base_cx = TestCx { config: &config, props: &base_props, - testpaths: testpaths, + testpaths, revision: None }; base_cx.init_all(); @@ -72,7 +72,7 @@ pub fn run(config: Config, testpaths: &TestPaths) { let rev_cx = TestCx { config: &config, props: &revision_props, - testpaths: testpaths, + testpaths, revision: Some(revision) }; rev_cx.run_revision(); @@ -354,7 +354,7 @@ impl<'test> TestCx<'test> { args.extend(self.props.compile_flags.iter().cloned()); ProcArgs { prog: self.config.rustc_path.to_str().unwrap().to_owned(), - args: args, + args, } } @@ -416,7 +416,7 @@ actual:\n\ // FIXME (#9639): This needs to handle non-utf8 paths ProcArgs { prog: self.config.rustc_path.to_str().unwrap().to_owned(), - args: args, + args, } } @@ -595,10 +595,10 @@ actual:\n\ }; debugger_run_result = ProcRes { - status: status, + status, stdout: out, stderr: err, - cmdline: cmdline + cmdline, }; if process.kill().is_err() { println!("Adb process is already finished."); @@ -852,7 +852,7 @@ actual:\n\ self.dump_output(&out, &err); ProcRes { - status: status, + status, stdout: out, stderr: err, cmdline: format!("{:?}", cmd) @@ -899,9 +899,9 @@ actual:\n\ } DebuggerCommands { - commands: commands, - check_lines: check_lines, - breakpoint_lines: breakpoint_lines, + commands, + check_lines, + breakpoint_lines, } } @@ -1206,7 +1206,7 @@ actual:\n\ let args = ProcArgs { prog: self.config.rustdoc_path .as_ref().expect("--rustdoc-path passed").to_str().unwrap().to_owned(), - args: args, + args, }; self.compose_and_run_compiler(args, None) } @@ -1482,7 +1482,7 @@ actual:\n\ args.extend(self.props.compile_flags.iter().cloned()); ProcArgs { prog: self.config.rustc_path.to_str().unwrap().to_owned(), - args: args, + args, } } @@ -1532,8 +1532,8 @@ actual:\n\ let prog = args.remove(0); ProcArgs { - prog: prog, - args: args, + prog, + args, } } @@ -1585,10 +1585,10 @@ actual:\n\ working_dir).expect(&format!("failed to exec `{}`", prog)); self.dump_output(&out, &err); ProcRes { - status: status, + status, stdout: out, stderr: err, - cmdline: cmdline, + cmdline, } }