Skip to content

Commit 1b6c960

Browse files
committed
use field init shorthand EVERYWHERE
Like #43008 (f668999), but _much more aggressive_.
1 parent 82be83c commit 1b6c960

File tree

281 files changed

+1376
-1376
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

281 files changed

+1376
-1376
lines changed

src/bootstrap/builder.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ pub struct ShouldRun<'a> {
193193
impl<'a> ShouldRun<'a> {
194194
fn new(builder: &'a Builder) -> ShouldRun<'a> {
195195
ShouldRun {
196-
builder: builder,
196+
builder,
197197
paths: BTreeSet::new(),
198198
is_really_default: true, // by default no additional conditions
199199
}
@@ -278,9 +278,9 @@ impl<'a> Builder<'a> {
278278
};
279279

280280
let builder = Builder {
281-
build: build,
281+
build,
282282
top_stage: build.config.stage.unwrap_or(2),
283-
kind: kind,
283+
kind,
284284
cache: Cache::new(),
285285
stack: RefCell::new(Vec::new()),
286286
};
@@ -309,9 +309,9 @@ impl<'a> Builder<'a> {
309309
};
310310

311311
let builder = Builder {
312-
build: build,
312+
build,
313313
top_stage: build.config.stage.unwrap_or(2),
314-
kind: kind,
314+
kind,
315315
cache: Cache::new(),
316316
stack: RefCell::new(Vec::new()),
317317
};

src/bootstrap/check.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ impl Step for CrateLibrustc {
872872
builder.ensure(CrateLibrustc {
873873
compiler,
874874
target: run.target,
875-
test_kind: test_kind,
875+
test_kind,
876876
krate: name,
877877
});
878878
};
@@ -934,8 +934,8 @@ impl Step for Crate {
934934
builder.ensure(Crate {
935935
compiler,
936936
target: run.target,
937-
mode: mode,
938-
test_kind: test_kind,
937+
mode,
938+
test_kind,
939939
krate: name,
940940
});
941941
};

src/bootstrap/compile.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,13 @@ impl Step for Std {
7474
let from = builder.compiler(1, build.build);
7575
builder.ensure(Std {
7676
compiler: from,
77-
target: target,
77+
target,
7878
});
7979
println!("Uplifting stage1 std ({} -> {})", from.host, target);
8080
builder.ensure(StdLink {
8181
compiler: from,
8282
target_compiler: compiler,
83-
target: target,
83+
target,
8484
});
8585
return;
8686
}
@@ -100,7 +100,7 @@ impl Step for Std {
100100
builder.ensure(StdLink {
101101
compiler: builder.compiler(compiler.stage, build.build),
102102
target_compiler: compiler,
103-
target: target,
103+
target,
104104
});
105105
}
106106
}
@@ -202,7 +202,7 @@ impl Step for StdLink {
202202

203203
builder.ensure(tool::CleanTools {
204204
compiler: target_compiler,
205-
target: target,
205+
target,
206206
mode: Mode::Libstd,
207207
});
208208
}
@@ -326,13 +326,13 @@ impl Step for Test {
326326
if build.force_use_stage1(compiler, target) {
327327
builder.ensure(Test {
328328
compiler: builder.compiler(1, build.build),
329-
target: target,
329+
target,
330330
});
331331
println!("Uplifting stage1 test ({} -> {})", &build.build, target);
332332
builder.ensure(TestLink {
333333
compiler: builder.compiler(1, build.build),
334334
target_compiler: compiler,
335-
target: target,
335+
target,
336336
});
337337
return;
338338
}
@@ -351,7 +351,7 @@ impl Step for Test {
351351
builder.ensure(TestLink {
352352
compiler: builder.compiler(compiler.stage, build.build),
353353
target_compiler: compiler,
354-
target: target,
354+
target,
355355
});
356356
}
357357
}
@@ -398,7 +398,7 @@ impl Step for TestLink {
398398
&libtest_stamp(build, compiler, target));
399399
builder.ensure(tool::CleanTools {
400400
compiler: target_compiler,
401-
target: target,
401+
target,
402402
mode: Mode::Libtest,
403403
});
404404
}
@@ -445,7 +445,7 @@ impl Step for Rustc {
445445
if build.force_use_stage1(compiler, target) {
446446
builder.ensure(Rustc {
447447
compiler: builder.compiler(1, build.build),
448-
target: target,
448+
target,
449449
});
450450
println!("Uplifting stage1 rustc ({} -> {})", &build.build, target);
451451
builder.ensure(RustcLink {
@@ -581,7 +581,7 @@ impl Step for RustcLink {
581581
&librustc_stamp(build, compiler, target));
582582
builder.ensure(tool::CleanTools {
583583
compiler: target_compiler,
584-
target: target,
584+
target,
585585
mode: Mode::Librustc,
586586
});
587587
}

src/bootstrap/doc.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -213,13 +213,13 @@ impl Step for TheBook {
213213
let name = self.name;
214214
// build book first edition
215215
builder.ensure(Rustbook {
216-
target: target,
216+
target,
217217
name: INTERNER.intern_string(format!("{}/first-edition", name)),
218218
});
219219

220220
// build book second edition
221221
builder.ensure(Rustbook {
222-
target: target,
222+
target,
223223
name: INTERNER.intern_string(format!("{}/second-edition", name)),
224224
});
225225

src/bootstrap/flags.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -274,14 +274,14 @@ Arguments:
274274
}
275275
"test" => {
276276
Subcommand::Test {
277-
paths: paths,
277+
paths,
278278
test_args: matches.opt_strs("test-args"),
279279
fail_fast: !matches.opt_present("no-fail-fast"),
280280
}
281281
}
282282
"bench" => {
283283
Subcommand::Bench {
284-
paths: paths,
284+
paths,
285285
test_args: matches.opt_strs("test-args"),
286286
}
287287
}
@@ -297,12 +297,12 @@ Arguments:
297297
}
298298
"dist" => {
299299
Subcommand::Dist {
300-
paths: paths,
300+
paths,
301301
}
302302
}
303303
"install" => {
304304
Subcommand::Install {
305-
paths: paths,
305+
paths,
306306
}
307307
}
308308
_ => {
@@ -324,7 +324,7 @@ Arguments:
324324

325325
Flags {
326326
verbose: matches.opt_count("verbose"),
327-
stage: stage,
327+
stage,
328328
on_fail: matches.opt_str("on-fail"),
329329
keep_stage: matches.opt_str("keep-stage").map(|j| j.parse().unwrap()),
330330
build: matches.opt_str("build").map(|s| INTERNER.intern_string(s)),
@@ -333,9 +333,9 @@ Arguments:
333333
target: split(matches.opt_strs("target"))
334334
.into_iter().map(|x| INTERNER.intern_string(x)).collect::<Vec<_>>(),
335335
config: cfg_file,
336-
src: src,
336+
src,
337337
jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()),
338-
cmd: cmd,
338+
cmd,
339339
incremental: matches.opt_present("incremental"),
340340
}
341341
}

src/bootstrap/lib.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -314,19 +314,19 @@ impl Build {
314314
hosts: config.hosts.clone(),
315315
targets: config.targets.clone(),
316316

317-
config: config,
318-
src: src,
319-
out: out,
317+
config,
318+
src,
319+
out,
320320

321-
rust_info: rust_info,
322-
cargo_info: cargo_info,
323-
rls_info: rls_info,
321+
rust_info,
322+
cargo_info,
323+
rls_info,
324324
cc: HashMap::new(),
325325
cxx: HashMap::new(),
326326
crates: HashMap::new(),
327327
lldb_version: None,
328328
lldb_python_dir: None,
329-
is_sudo: is_sudo,
329+
is_sudo,
330330
ci_env: CiEnv::current(),
331331
delayed_failures: Cell::new(0),
332332
}

src/bootstrap/metadata.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,10 @@ fn build_krate(build: &mut Build, krate: &str) {
7575
doc_step: format!("doc-crate-{}", name),
7676
test_step: format!("test-crate-{}", name),
7777
bench_step: format!("bench-crate-{}", name),
78-
name: name,
78+
name,
7979
version: package.version,
8080
deps: Vec::new(),
81-
path: path,
81+
path,
8282
});
8383
}
8484
}

src/liballoc/arc.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ impl<T> Arc<T> {
278278
let x: Box<_> = box ArcInner {
279279
strong: atomic::AtomicUsize::new(1),
280280
weak: atomic::AtomicUsize::new(1),
281-
data: data,
281+
data,
282282
};
283283
Arc { ptr: Shared::from(Box::into_unique(x)) }
284284
}

src/liballoc/binary_heap.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -853,9 +853,9 @@ impl<'a, T> Hole<'a, T> {
853853
debug_assert!(pos < data.len());
854854
let elt = ptr::read(&data[pos]);
855855
Hole {
856-
data: data,
856+
data,
857857
elt: Some(elt),
858-
pos: pos,
858+
pos,
859859
}
860860
}
861861

@@ -1203,7 +1203,7 @@ where T: Clone + Ord {
12031203
let place = Placer::make_place(self.data.place_back());
12041204
BinaryHeapPlace {
12051205
heap: ptr,
1206-
place: place,
1206+
place,
12071207
}
12081208
}
12091209
}

src/liballoc/boxed.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ fn make_place<T>() -> IntermediateBox<T> {
169169

170170
IntermediateBox {
171171
ptr: p,
172-
layout: layout,
172+
layout,
173173
marker: marker::PhantomData,
174174
}
175175
}

src/liballoc/btree/map.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
234234
match search::search_tree(self.root.as_mut(), key) {
235235
Found(handle) => {
236236
Some(OccupiedEntry {
237-
handle: handle,
237+
handle,
238238
length: &mut self.length,
239239
_marker: PhantomData,
240240
}
@@ -250,8 +250,8 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
250250
Found(handle) => Some(mem::replace(handle.into_kv_mut().0, key)),
251251
GoDown(handle) => {
252252
VacantEntry {
253-
key: key,
254-
handle: handle,
253+
key,
254+
handle,
255255
length: &mut self.length,
256256
_marker: PhantomData,
257257
}
@@ -695,7 +695,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
695695
match search::search_tree(self.root.as_mut(), key) {
696696
Found(handle) => {
697697
Some(OccupiedEntry {
698-
handle: handle,
698+
handle,
699699
length: &mut self.length,
700700
_marker: PhantomData,
701701
}
@@ -866,15 +866,15 @@ impl<K: Ord, V> BTreeMap<K, V> {
866866
match search::search_tree(self.root.as_mut(), &key) {
867867
Found(handle) => {
868868
Occupied(OccupiedEntry {
869-
handle: handle,
869+
handle,
870870
length: &mut self.length,
871871
_marker: PhantomData,
872872
})
873873
}
874874
GoDown(handle) => {
875875
Vacant(VacantEntry {
876-
key: key,
877-
handle: handle,
876+
key,
877+
handle,
878878
length: &mut self.length,
879879
_marker: PhantomData,
880880
})

src/liballoc/btree/node.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -776,8 +776,8 @@ impl<BorrowType, K, V, NodeType> Handle<NodeRef<BorrowType, K, V, NodeType>, mar
776776
debug_assert!(idx < node.len());
777777

778778
Handle {
779-
node: node,
780-
idx: idx,
779+
node,
780+
idx,
781781
_marker: PhantomData
782782
}
783783
}
@@ -850,8 +850,8 @@ impl<BorrowType, K, V, NodeType>
850850
debug_assert!(idx <= node.len());
851851

852852
Handle {
853-
node: node,
854-
idx: idx,
853+
node,
854+
idx,
855855
_marker: PhantomData
856856
}
857857
}
@@ -1149,7 +1149,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, K, V, marker::Internal>, marker::
11491149

11501150
let mut new_root = Root {
11511151
node: BoxedNode::from_internal(new_node),
1152-
height: height
1152+
height,
11531153
};
11541154

11551155
for i in 0..(new_len+1) {
@@ -1449,12 +1449,12 @@ impl<BorrowType, K, V, HandleType>
14491449
> {
14501450
match self.node.force() {
14511451
ForceResult::Leaf(node) => ForceResult::Leaf(Handle {
1452-
node: node,
1452+
node,
14531453
idx: self.idx,
14541454
_marker: PhantomData
14551455
}),
14561456
ForceResult::Internal(node) => ForceResult::Internal(Handle {
1457-
node: node,
1457+
node,
14581458
idx: self.idx,
14591459
_marker: PhantomData
14601460
})

src/liballoc/linked_list.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ impl<T> Node<T> {
140140
Node {
141141
next: None,
142142
prev: None,
143-
element: element,
143+
element,
144144
}
145145
}
146146

@@ -924,7 +924,7 @@ impl<'a, T> IterMut<'a, T> {
924924
let node = Some(Shared::from(Box::into_unique(box Node {
925925
next: Some(head),
926926
prev: Some(prev),
927-
element: element,
927+
element,
928928
})));
929929

930930
prev.as_mut().next = node;

0 commit comments

Comments
 (0)