Skip to content

Commit 3361918

Browse files
committed
Auto merge of #5070 - Eh2406:clippy, r=alexcrichton
Some Clippy suggestions This is just some suggestions from Clippy and intellij rust. Clippy still has a lot to say, but this is some of the simple things.
2 parents 83afa6e + 1ef675e commit 3361918

Some content is hidden

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

71 files changed

+316
-305
lines changed

src/bin/bench.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,13 @@ pub fn execute(mut options: Options, config: &mut Config) -> CliResult {
121121
no_fail_fast: options.flag_no_fail_fast,
122122
only_doc: false,
123123
compile_opts: ops::CompileOptions {
124-
config: config,
124+
config,
125125
jobs: options.flag_jobs,
126126
target: options.flag_target.as_ref().map(|s| &s[..]),
127127
features: &options.flag_features,
128128
all_features: options.flag_all_features,
129129
no_default_features: options.flag_no_default_features,
130-
spec: spec,
130+
spec,
131131
release: true,
132132
mode: ops::CompileMode::Bench,
133133
filter: ops::CompileFilter::new(options.flag_lib,

src/bin/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,13 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
105105
&options.flag_package)?;
106106

107107
let opts = CompileOptions {
108-
config: config,
108+
config,
109109
jobs: options.flag_jobs,
110110
target: options.flag_target.as_ref().map(|t| &t[..]),
111111
features: &options.flag_features,
112112
all_features: options.flag_all_features,
113113
no_default_features: options.flag_no_default_features,
114-
spec: spec,
114+
spec,
115115
mode: ops::CompileMode::Build,
116116
release: options.flag_release,
117117
filter: ops::CompileFilter::new(options.flag_lib,

src/bin/check.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,14 +121,14 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
121121
};
122122

123123
let opts = CompileOptions {
124-
config: config,
124+
config,
125125
jobs: options.flag_jobs,
126126
target: options.flag_target.as_ref().map(|t| &t[..]),
127127
features: &options.flag_features,
128128
all_features: options.flag_all_features,
129129
no_default_features: options.flag_no_default_features,
130-
spec: spec,
131-
mode: ops::CompileMode::Check{test:test},
130+
spec,
131+
mode: ops::CompileMode::Check{test },
132132
release: options.flag_release,
133133
filter: ops::CompileFilter::new(options.flag_lib,
134134
&options.flag_bin, options.flag_bins,

src/bin/clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
5656

5757
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
5858
let opts = ops::CleanOptions {
59-
config: config,
59+
config,
6060
spec: &options.flag_package,
6161
target: options.flag_target.as_ref().map(|s| &s[..]),
6262
release: options.flag_release,

src/bin/doc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,13 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
9898
let doc_opts = ops::DocOptions {
9999
open_result: options.flag_open,
100100
compile_opts: ops::CompileOptions {
101-
config: config,
101+
config,
102102
jobs: options.flag_jobs,
103103
target: options.flag_target.as_ref().map(|t| &t[..]),
104104
features: &options.flag_features,
105105
all_features: options.flag_all_features,
106106
no_default_features: options.flag_no_default_features,
107-
spec: spec,
107+
spec,
108108
filter: ops::CompileFilter::new(options.flag_lib,
109109
&options.flag_bin, options.flag_bins,
110110
&empty, false,

src/bin/install.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
118118
&options.flag_z)?;
119119

120120
let compile_opts = ops::CompileOptions {
121-
config: config,
121+
config,
122122
jobs: options.flag_jobs,
123123
target: None,
124124
features: &options.flag_features,

src/bin/package.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
5454
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
5555
let ws = Workspace::new(&root, config)?;
5656
ops::package(&ws, &ops::PackageOpts {
57-
config: config,
57+
config,
5858
verify: !options.flag_no_verify,
5959
list: options.flag_list,
6060
check_metadata: !options.flag_no_metadata,

src/bin/publish.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,17 +97,17 @@ about this warning.";
9797
let root = find_root_manifest_for_wd(flag_manifest_path.clone(), config.cwd())?;
9898
let ws = Workspace::new(&root, config)?;
9999
ops::publish(&ws, &ops::PublishOpts {
100-
config: config,
101-
token: token,
100+
config,
101+
token,
102102
index:
103103
if host.clone().is_none() || host.clone().unwrap().is_empty() { index }
104104
else { config.shell().warn(&msg)?; host }, // TODO: Deprecated, remove
105105
verify: !no_verify,
106-
allow_dirty: allow_dirty,
106+
allow_dirty,
107107
target: target.as_ref().map(|t| &t[..]),
108-
jobs: jobs,
109-
dry_run: dry_run,
110-
registry: registry,
108+
jobs,
109+
dry_run,
110+
registry,
111111
})?;
112112
Ok(())
113113
}

src/bin/run.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,13 +86,13 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
8686
let spec = Packages::Packages(&packages);
8787

8888
let compile_opts = ops::CompileOptions {
89-
config: config,
89+
config,
9090
jobs: options.flag_jobs,
9191
target: options.flag_target.as_ref().map(|t| &t[..]),
9292
features: &options.flag_features,
9393
all_features: options.flag_all_features,
9494
no_default_features: options.flag_no_default_features,
95-
spec: spec,
95+
spec,
9696
release: options.flag_release,
9797
mode: ops::CompileMode::Build,
9898
filter: if examples.is_empty() && bins.is_empty() {

src/bin/rustc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
113113
let spec = options.flag_package.map_or_else(Vec::new, |s| vec![s]);
114114

115115
let opts = CompileOptions {
116-
config: config,
116+
config,
117117
jobs: options.flag_jobs,
118118
target: options.flag_target.as_ref().map(|t| &t[..]),
119119
features: &options.flag_features,
120120
all_features: options.flag_all_features,
121121
no_default_features: options.flag_no_default_features,
122122
spec: Packages::Packages(&spec),
123-
mode: mode,
123+
mode,
124124
release: options.flag_release,
125125
filter: ops::CompileFilter::new(options.flag_lib,
126126
&options.flag_bin, options.flag_bins,

src/bin/rustdoc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
9999
let doc_opts = ops::DocOptions {
100100
open_result: options.flag_open,
101101
compile_opts: ops::CompileOptions {
102-
config: config,
102+
config,
103103
jobs: options.flag_jobs,
104104
target: options.flag_target.as_ref().map(|t| &t[..]),
105105
features: &options.flag_features,

src/bin/test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,16 @@ pub fn execute(mut options: Options, config: &mut Config) -> CliResult {
159159
no_fail_fast: options.flag_no_fail_fast,
160160
only_doc: options.flag_doc,
161161
compile_opts: ops::CompileOptions {
162-
config: config,
162+
config,
163163
jobs: options.flag_jobs,
164164
target: options.flag_target.as_ref().map(|s| &s[..]),
165165
features: &options.flag_features,
166166
all_features: options.flag_all_features,
167167
no_default_features: options.flag_no_default_features,
168-
spec: spec,
168+
spec,
169169
release: options.flag_release,
170-
mode: mode,
171-
filter: filter,
170+
mode,
171+
filter,
172172
message_format: options.flag_message_format,
173173
target_rustdoc_args: None,
174174
target_rustc_args: None,

src/bin/update.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
7474
aggressive: options.flag_aggressive,
7575
precise: options.flag_precise.as_ref().map(|s| &s[..]),
7676
to_update: &options.flag_package,
77-
config: config,
77+
config,
7878
};
7979

8080
let ws = Workspace::new(&root, config)?;

src/cargo/core/features.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ macro_rules! features {
9999
}
100100
static FEAT: Feature = Feature {
101101
name: stringify!($feature),
102-
get: get,
102+
get,
103103
};
104104
&FEAT
105105
}

src/cargo/core/manifest.rs

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -275,22 +275,22 @@ impl Manifest {
275275
im_a_teapot: Option<bool>,
276276
original: Rc<TomlManifest>) -> Manifest {
277277
Manifest {
278-
summary: summary,
279-
targets: targets,
278+
summary,
279+
targets,
280280
warnings: Vec::new(),
281-
exclude: exclude,
282-
include: include,
283-
links: links,
284-
metadata: metadata,
285-
profiles: profiles,
286-
publish: publish,
287-
replace: replace,
288-
patch: patch,
289-
workspace: workspace,
290-
features: features,
291-
epoch: epoch,
292-
original: original,
293-
im_a_teapot: im_a_teapot,
281+
exclude,
282+
include,
283+
links,
284+
metadata,
285+
profiles,
286+
publish,
287+
replace,
288+
patch,
289+
workspace,
290+
features,
291+
epoch,
292+
original,
293+
im_a_teapot,
294294
}
295295
}
296296

@@ -372,10 +372,10 @@ impl VirtualManifest {
372372
workspace: WorkspaceConfig,
373373
profiles: Profiles) -> VirtualManifest {
374374
VirtualManifest {
375-
replace: replace,
376-
patch: patch,
377-
workspace: workspace,
378-
profiles: profiles,
375+
replace,
376+
patch,
377+
workspace,
378+
profiles,
379379
}
380380
}
381381

@@ -430,7 +430,7 @@ impl Target {
430430
Target {
431431
kind: TargetKind::Bin,
432432
name: name.to_string(),
433-
required_features: required_features,
433+
required_features,
434434
doc: true,
435435
..Target::with_path(src_path)
436436
}
@@ -459,9 +459,9 @@ impl Target {
459459
};
460460

461461
Target {
462-
kind: kind,
462+
kind,
463463
name: name.to_string(),
464-
required_features: required_features,
464+
required_features,
465465
benched: false,
466466
..Target::with_path(src_path)
467467
}
@@ -472,7 +472,7 @@ impl Target {
472472
Target {
473473
kind: TargetKind::Test,
474474
name: name.to_string(),
475-
required_features: required_features,
475+
required_features,
476476
benched: false,
477477
..Target::with_path(src_path)
478478
}
@@ -483,7 +483,7 @@ impl Target {
483483
Target {
484484
kind: TargetKind::Bench,
485485
name: name.to_string(),
486-
required_features: required_features,
486+
required_features,
487487
tested: false,
488488
..Target::with_path(src_path)
489489
}

src/cargo/core/package.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ impl ser::Serialize for Package {
5858
name: package_id.name(),
5959
version: &package_id.version().to_string(),
6060
id: package_id,
61-
license: license,
62-
license_file: license_file,
63-
description: description,
61+
license,
62+
license_file,
63+
description,
6464
source: summary.source_id(),
6565
dependencies: summary.dependencies(),
6666
targets: self.manifest.targets(),
@@ -75,7 +75,7 @@ impl Package {
7575
pub fn new(manifest: Manifest,
7676
manifest_path: &Path) -> Package {
7777
Package {
78-
manifest: manifest,
78+
manifest,
7979
manifest_path: manifest_path.to_path_buf(),
8080
}
8181
}

src/cargo/core/package_id.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ impl<'de> de::Deserialize<'de> for PackageId {
6464
Ok(PackageId {
6565
inner: Arc::new(PackageIdInner {
6666
name: name.to_string(),
67-
version: version,
68-
source_id: source_id,
67+
version,
68+
source_id,
6969
}),
7070
})
7171
}

src/cargo/core/package_id_spec.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl PackageIdSpec {
4040
}
4141
Ok(PackageIdSpec {
4242
name: name.to_string(),
43-
version: version,
43+
version,
4444
url: None,
4545
})
4646
}
@@ -100,8 +100,8 @@ impl PackageIdSpec {
100100
}
101101
};
102102
Ok(PackageIdSpec {
103-
name: name,
104-
version: version,
103+
name,
104+
version,
105105
url: Some(url),
106106
})
107107
}

src/cargo/core/registry.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<'cfg> PackageRegistry<'cfg> {
110110
sources: SourceMap::new(),
111111
source_ids: HashMap::new(),
112112
overrides: Vec::new(),
113-
source_config: source_config,
113+
source_config,
114114
locked: HashMap::new(),
115115
patches: HashMap::new(),
116116
patches_locked: false,
@@ -187,9 +187,9 @@ impl<'cfg> PackageRegistry<'cfg> {
187187
trace!("\t-> {}", dep);
188188
}
189189
let sub_map = self.locked.entry(id.source_id().clone())
190-
.or_insert(HashMap::new());
190+
.or_insert_with(HashMap::new);
191191
let sub_vec = sub_map.entry(id.name().to_string())
192-
.or_insert(Vec::new());
192+
.or_insert_with(Vec::new);
193193
sub_vec.push((id, deps));
194194
}
195195

0 commit comments

Comments
 (0)