Skip to content

Commit

Permalink
Auto merge of #5070 - Eh2406:clippy, r=alexcrichton
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Feb 27, 2018
2 parents 83afa6e + 1ef675e commit 3361918
Show file tree
Hide file tree
Showing 71 changed files with 316 additions and 305 deletions.
4 changes: 2 additions & 2 deletions src/bin/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@ pub fn execute(mut options: Options, config: &mut Config) -> CliResult {
no_fail_fast: options.flag_no_fail_fast,
only_doc: false,
compile_opts: ops::CompileOptions {
config: config,
config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|s| &s[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: spec,
spec,
release: true,
mode: ops::CompileMode::Bench,
filter: ops::CompileFilter::new(options.flag_lib,
Expand Down
4 changes: 2 additions & 2 deletions src/bin/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
&options.flag_package)?;

let opts = CompileOptions {
config: config,
config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: spec,
spec,
mode: ops::CompileMode::Build,
release: options.flag_release,
filter: ops::CompileFilter::new(options.flag_lib,
Expand Down
6 changes: 3 additions & 3 deletions src/bin/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
};

let opts = CompileOptions {
config: config,
config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: spec,
mode: ops::CompileMode::Check{test:test},
spec,
mode: ops::CompileMode::Check{test },
release: options.flag_release,
filter: ops::CompileFilter::new(options.flag_lib,
&options.flag_bin, options.flag_bins,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/clean.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {

let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
let opts = ops::CleanOptions {
config: config,
config,
spec: &options.flag_package,
target: options.flag_target.as_ref().map(|s| &s[..]),
release: options.flag_release,
Expand Down
4 changes: 2 additions & 2 deletions src/bin/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
let doc_opts = ops::DocOptions {
open_result: options.flag_open,
compile_opts: ops::CompileOptions {
config: config,
config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: spec,
spec,
filter: ops::CompileFilter::new(options.flag_lib,
&options.flag_bin, options.flag_bins,
&empty, false,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
&options.flag_z)?;

let compile_opts = ops::CompileOptions {
config: config,
config,
jobs: options.flag_jobs,
target: None,
features: &options.flag_features,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
let root = find_root_manifest_for_wd(options.flag_manifest_path, config.cwd())?;
let ws = Workspace::new(&root, config)?;
ops::package(&ws, &ops::PackageOpts {
config: config,
config,
verify: !options.flag_no_verify,
list: options.flag_list,
check_metadata: !options.flag_no_metadata,
Expand Down
12 changes: 6 additions & 6 deletions src/bin/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,17 @@ about this warning.";
let root = find_root_manifest_for_wd(flag_manifest_path.clone(), config.cwd())?;
let ws = Workspace::new(&root, config)?;
ops::publish(&ws, &ops::PublishOpts {
config: config,
token: token,
config,
token,
index:
if host.clone().is_none() || host.clone().unwrap().is_empty() { index }
else { config.shell().warn(&msg)?; host }, // TODO: Deprecated, remove
verify: !no_verify,
allow_dirty: allow_dirty,
allow_dirty,
target: target.as_ref().map(|t| &t[..]),
jobs: jobs,
dry_run: dry_run,
registry: registry,
jobs,
dry_run,
registry,
})?;
Ok(())
}
4 changes: 2 additions & 2 deletions src/bin/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
let spec = Packages::Packages(&packages);

let compile_opts = ops::CompileOptions {
config: config,
config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: spec,
spec,
release: options.flag_release,
mode: ops::CompileMode::Build,
filter: if examples.is_empty() && bins.is_empty() {
Expand Down
4 changes: 2 additions & 2 deletions src/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
let spec = options.flag_package.map_or_else(Vec::new, |s| vec![s]);

let opts = CompileOptions {
config: config,
config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: Packages::Packages(&spec),
mode: mode,
mode,
release: options.flag_release,
filter: ops::CompileFilter::new(options.flag_lib,
&options.flag_bin, options.flag_bins,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
let doc_opts = ops::DocOptions {
open_result: options.flag_open,
compile_opts: ops::CompileOptions {
config: config,
config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|t| &t[..]),
features: &options.flag_features,
Expand Down
8 changes: 4 additions & 4 deletions src/bin/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,16 +159,16 @@ pub fn execute(mut options: Options, config: &mut Config) -> CliResult {
no_fail_fast: options.flag_no_fail_fast,
only_doc: options.flag_doc,
compile_opts: ops::CompileOptions {
config: config,
config,
jobs: options.flag_jobs,
target: options.flag_target.as_ref().map(|s| &s[..]),
features: &options.flag_features,
all_features: options.flag_all_features,
no_default_features: options.flag_no_default_features,
spec: spec,
spec,
release: options.flag_release,
mode: mode,
filter: filter,
mode,
filter,
message_format: options.flag_message_format,
target_rustdoc_args: None,
target_rustc_args: None,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ pub fn execute(options: Options, config: &mut Config) -> CliResult {
aggressive: options.flag_aggressive,
precise: options.flag_precise.as_ref().map(|s| &s[..]),
to_update: &options.flag_package,
config: config,
config,
};

let ws = Workspace::new(&root, config)?;
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ macro_rules! features {
}
static FEAT: Feature = Feature {
name: stringify!($feature),
get: get,
get,
};
&FEAT
}
Expand Down
48 changes: 24 additions & 24 deletions src/cargo/core/manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,22 +275,22 @@ impl Manifest {
im_a_teapot: Option<bool>,
original: Rc<TomlManifest>) -> Manifest {
Manifest {
summary: summary,
targets: targets,
summary,
targets,
warnings: Vec::new(),
exclude: exclude,
include: include,
links: links,
metadata: metadata,
profiles: profiles,
publish: publish,
replace: replace,
patch: patch,
workspace: workspace,
features: features,
epoch: epoch,
original: original,
im_a_teapot: im_a_teapot,
exclude,
include,
links,
metadata,
profiles,
publish,
replace,
patch,
workspace,
features,
epoch,
original,
im_a_teapot,
}
}

Expand Down Expand Up @@ -372,10 +372,10 @@ impl VirtualManifest {
workspace: WorkspaceConfig,
profiles: Profiles) -> VirtualManifest {
VirtualManifest {
replace: replace,
patch: patch,
workspace: workspace,
profiles: profiles,
replace,
patch,
workspace,
profiles,
}
}

Expand Down Expand Up @@ -430,7 +430,7 @@ impl Target {
Target {
kind: TargetKind::Bin,
name: name.to_string(),
required_features: required_features,
required_features,
doc: true,
..Target::with_path(src_path)
}
Expand Down Expand Up @@ -459,9 +459,9 @@ impl Target {
};

Target {
kind: kind,
kind,
name: name.to_string(),
required_features: required_features,
required_features,
benched: false,
..Target::with_path(src_path)
}
Expand All @@ -472,7 +472,7 @@ impl Target {
Target {
kind: TargetKind::Test,
name: name.to_string(),
required_features: required_features,
required_features,
benched: false,
..Target::with_path(src_path)
}
Expand All @@ -483,7 +483,7 @@ impl Target {
Target {
kind: TargetKind::Bench,
name: name.to_string(),
required_features: required_features,
required_features,
tested: false,
..Target::with_path(src_path)
}
Expand Down
8 changes: 4 additions & 4 deletions src/cargo/core/package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ impl ser::Serialize for Package {
name: package_id.name(),
version: &package_id.version().to_string(),
id: package_id,
license: license,
license_file: license_file,
description: description,
license,
license_file,
description,
source: summary.source_id(),
dependencies: summary.dependencies(),
targets: self.manifest.targets(),
Expand All @@ -75,7 +75,7 @@ impl Package {
pub fn new(manifest: Manifest,
manifest_path: &Path) -> Package {
Package {
manifest: manifest,
manifest,
manifest_path: manifest_path.to_path_buf(),
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/core/package_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ impl<'de> de::Deserialize<'de> for PackageId {
Ok(PackageId {
inner: Arc::new(PackageIdInner {
name: name.to_string(),
version: version,
source_id: source_id,
version,
source_id,
}),
})
}
Expand Down
6 changes: 3 additions & 3 deletions src/cargo/core/package_id_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ impl PackageIdSpec {
}
Ok(PackageIdSpec {
name: name.to_string(),
version: version,
version,
url: None,
})
}
Expand Down Expand Up @@ -100,8 +100,8 @@ impl PackageIdSpec {
}
};
Ok(PackageIdSpec {
name: name,
version: version,
name,
version,
url: Some(url),
})
}
Expand Down
6 changes: 3 additions & 3 deletions src/cargo/core/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl<'cfg> PackageRegistry<'cfg> {
sources: SourceMap::new(),
source_ids: HashMap::new(),
overrides: Vec::new(),
source_config: source_config,
source_config,
locked: HashMap::new(),
patches: HashMap::new(),
patches_locked: false,
Expand Down Expand Up @@ -187,9 +187,9 @@ impl<'cfg> PackageRegistry<'cfg> {
trace!("\t-> {}", dep);
}
let sub_map = self.locked.entry(id.source_id().clone())
.or_insert(HashMap::new());
.or_insert_with(HashMap::new);
let sub_vec = sub_map.entry(id.name().to_string())
.or_insert(Vec::new());
.or_insert_with(Vec::new);
sub_vec.push((id, deps));
}

Expand Down
Loading

0 comments on commit 3361918

Please sign in to comment.