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

Some minor clippy fixes. #7484

Merged
merged 1 commit into from
Oct 7, 2019
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
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/build_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ impl ProfileKind {
match self {
ProfileKind::Dev => "dev",
ProfileKind::Release => "release",
ProfileKind::Custom(name) => &name,
ProfileKind::Custom(name) => name,
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/build_context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ impl<'a, 'cfg> BuildContext<'a, 'cfg> {
None => return true,
};
let name = kind.short_name(self);
platform.matches(&name, self.cfg(kind))
platform.matches(name, self.cfg(kind))
}

/// Gets the user-specified linker for a particular host or target.
Expand Down
6 changes: 3 additions & 3 deletions src/cargo/core/profiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ impl Profiles {
_ => {}
};

let mut maker = self.process_chain(name, &profile, &mut set, &mut result, profiles)?;
let mut maker = self.process_chain(name, profile, &mut set, &mut result, profiles)?;
result.reverse();
maker.inherits = result;

Expand All @@ -263,7 +263,7 @@ impl Profiles {

fn process_chain(
&mut self,
name: &String,
name: &str,
profile: &TomlProfile,
set: &mut HashSet<String>,
result: &mut Vec<TomlProfile>,
Expand All @@ -273,7 +273,7 @@ impl Profiles {
match profile.inherits.as_ref().map(|x| x.as_str()) {
Some(name @ "dev") | Some(name @ "release") => {
// These are the root profiles
return Ok(self.by_name.get(name).unwrap().clone());
Ok(self.by_name.get(name).unwrap().clone())
}
Some(name) => {
let name = name.to_owned();
Expand Down
10 changes: 4 additions & 6 deletions src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,13 +292,11 @@ fn check_repo_state(
if let Ok(status) = repo.status_file(relative) {
if status == git2::Status::CURRENT {
false
} else if relative.to_str().unwrap_or("") == "Cargo.lock" {
// It is OK to include this file even if it is ignored.
status != git2::Status::IGNORED
} else {
if relative.to_str().unwrap_or("") == "Cargo.lock" {
// It is OK to include this file even if it is ignored.
status != git2::Status::IGNORED
} else {
true
}
true
}
} else {
submodule_dirty(file)
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/ops/cargo_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,12 @@ fn run_doc_tests(
p.arg("--enable-per-target-ignores");
}

runtool.as_ref().map(|(runtool, runtool_args)| {
if let Some((runtool, runtool_args)) = runtool {
p.arg("--runtool").arg(runtool);
for arg in runtool_args {
p.arg("--runtool-arg").arg(arg);
}
});
}

for &rust_dep in &[&compilation.deps_output] {
let mut arg = OsString::from("dependency=");
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/common_for_install_and_uninstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ impl InstallInfo {
self.features == feature_set(&opts.features)
&& self.all_features == opts.all_features
&& self.no_default_features == opts.no_default_features
&& self.profile == opts.build_config.profile_name().to_string()
&& self.profile == opts.build_config.profile_name()
&& (self.target.is_none() || self.target.as_ref().map(|t| t.as_ref()) == Some(target))
&& &self.bins == exes
}
Expand Down
6 changes: 2 additions & 4 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,8 @@ pub trait ArgMatchesExt {
match profile_checking {
ProfileChecking::Unchecked => {}
ProfileChecking::Checked => {
if specified_profile.is_some() {
if !config.cli_unstable().unstable_options {
failure::bail!("Usage of `--profile` requires `-Z unstable-options`")
}
if specified_profile.is_some() && !config.cli_unstable().unstable_options {
failure::bail!("Usage of `--profile` requires `-Z unstable-options`")
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ impl TomlProfiles {
warnings.push("use `[profile.dev]` to configure debug builds".to_string());
}

profile.validate(&name, features, warnings)?;
profile.validate(name, features, warnings)?;
}
Ok(())
}
Expand Down Expand Up @@ -490,15 +490,15 @@ impl TomlProfile {
match &self.dir_name {
None => {}
Some(dir_name) => {
Self::validate_name(&dir_name, "dir-name")?;
Self::validate_name(dir_name, "dir-name")?;
}
}

// `inherits` validation
match &self.inherits {
None => {}
Some(inherits) => {
Self::validate_name(&inherits, "inherits")?;
Self::validate_name(inherits, "inherits")?;
}
}

Expand Down Expand Up @@ -581,31 +581,31 @@ impl TomlProfile {
}

if let Some(v) = profile.codegen_units {
self.codegen_units = Some(v.clone());
self.codegen_units = Some(v);
}

if let Some(v) = &profile.debug {
self.debug = Some(v.clone());
}

if let Some(v) = profile.debug_assertions {
self.debug_assertions = Some(v.clone());
self.debug_assertions = Some(v);
}

if let Some(v) = profile.rpath {
self.rpath = Some(v.clone());
self.rpath = Some(v);
}

if let Some(v) = &profile.panic {
self.panic = Some(v.clone());
}

if let Some(v) = profile.overflow_checks {
self.overflow_checks = Some(v.clone());
self.overflow_checks = Some(v);
}

if let Some(v) = profile.incremental {
self.incremental = Some(v.clone());
self.incremental = Some(v);
}

if let Some(v) = &profile.overrides {
Expand Down