Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use field init shorthand EVERYWHERE #43710

Merged
merged 1 commit into from
Aug 16, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/bootstrap/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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()),
};
Expand Down Expand Up @@ -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()),
};
Expand Down
6 changes: 3 additions & 3 deletions src/bootstrap/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 +872,7 @@ impl Step for CrateLibrustc {
builder.ensure(CrateLibrustc {
compiler,
target: run.target,
test_kind: test_kind,
test_kind,
krate: name,
});
};
Expand Down Expand Up @@ -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,
});
};
Expand Down
20 changes: 10 additions & 10 deletions src/bootstrap/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -100,7 +100,7 @@ impl Step for Std {
builder.ensure(StdLink {
compiler: builder.compiler(compiler.stage, build.build),
target_compiler: compiler,
target: target,
target,
});
}
}
Expand Down Expand Up @@ -202,7 +202,7 @@ impl Step for StdLink {

builder.ensure(tool::CleanTools {
compiler: target_compiler,
target: target,
target,
mode: Mode::Libstd,
});
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -351,7 +351,7 @@ impl Step for Test {
builder.ensure(TestLink {
compiler: builder.compiler(compiler.stage, build.build),
target_compiler: compiler,
target: target,
target,
});
}
}
Expand Down Expand Up @@ -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,
});
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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,
});
}
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
});

Expand Down
14 changes: 7 additions & 7 deletions src/bootstrap/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
}
}
Expand All @@ -297,12 +297,12 @@ Arguments:
}
"dist" => {
Subcommand::Dist {
paths: paths,
paths,
}
}
"install" => {
Subcommand::Install {
paths: paths,
paths,
}
}
_ => {
Expand All @@ -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)),
Expand All @@ -333,9 +333,9 @@ Arguments:
target: split(matches.opt_strs("target"))
.into_iter().map(|x| INTERNER.intern_string(x)).collect::<Vec<_>>(),
config: cfg_file,
src: src,
src,
jobs: matches.opt_str("jobs").map(|j| j.parse().unwrap()),
cmd: cmd,
cmd,
incremental: matches.opt_present("incremental"),
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/arc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ impl<T> Arc<T> {
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)) }
}
Expand Down
6 changes: 3 additions & 3 deletions src/liballoc/binary_heap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}

Expand Down Expand Up @@ -1203,7 +1203,7 @@ where T: Clone + Ord {
let place = Placer::make_place(self.data.place_back());
BinaryHeapPlace {
heap: ptr,
place: place,
place,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/liballoc/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ fn make_place<T>() -> IntermediateBox<T> {

IntermediateBox {
ptr: p,
layout: layout,
layout,
marker: marker::PhantomData,
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/liballoc/btree/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
match search::search_tree(self.root.as_mut(), key) {
Found(handle) => {
Some(OccupiedEntry {
handle: handle,
handle,
length: &mut self.length,
_marker: PhantomData,
}
Expand All @@ -250,8 +250,8 @@ impl<K, Q: ?Sized> super::Recover<Q> for BTreeMap<K, ()>
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,
}
Expand Down Expand Up @@ -695,7 +695,7 @@ impl<K: Ord, V> BTreeMap<K, V> {
match search::search_tree(self.root.as_mut(), key) {
Found(handle) => {
Some(OccupiedEntry {
handle: handle,
handle,
length: &mut self.length,
_marker: PhantomData,
}
Expand Down Expand Up @@ -866,15 +866,15 @@ impl<K: Ord, V> BTreeMap<K, V> {
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,
})
Expand Down
14 changes: 7 additions & 7 deletions src/liballoc/btree/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -776,8 +776,8 @@ impl<BorrowType, K, V, NodeType> Handle<NodeRef<BorrowType, K, V, NodeType>, mar
debug_assert!(idx < node.len());

Handle {
node: node,
idx: idx,
node,
idx,
_marker: PhantomData
}
}
Expand Down Expand Up @@ -850,8 +850,8 @@ impl<BorrowType, K, V, NodeType>
debug_assert!(idx <= node.len());

Handle {
node: node,
idx: idx,
node,
idx,
_marker: PhantomData
}
}
Expand Down Expand Up @@ -1149,7 +1149,7 @@ impl<'a, K, V> Handle<NodeRef<marker::Mut<'a>, 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) {
Expand Down Expand Up @@ -1449,12 +1449,12 @@ impl<BorrowType, K, V, HandleType>
> {
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
})
Expand Down
4 changes: 2 additions & 2 deletions src/liballoc/linked_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl<T> Node<T> {
Node {
next: None,
prev: None,
element: element,
element,
}
}

Expand Down Expand Up @@ -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;
Expand Down
Loading