Skip to content

Commit

Permalink
Auto merge of #7135 - ehuss:clippy-fixes, r=Eh2406
Browse files Browse the repository at this point in the history
Fix some clippy warnings.
  • Loading branch information
bors committed Jul 15, 2019
2 parents 1140c52 + 9fa6560 commit 7b84c53
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/bin/cargo/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub fn main(config: &mut Config) -> CliResult {
return super::execute_external_subcommand(config, cmd, &[cmd, "--help"])
.map_err(|_| e.into());
} else {
return Err(e)?;
return Err(e.into());
}
}
};
Expand Down
5 changes: 3 additions & 2 deletions src/bin/cargo/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
let root = args.value_of("root");

if args.is_present("no-track") && !config.cli_unstable().install_upgrade {
Err(failure::format_err!(
return Err(failure::format_err!(
"`--no-track` flag is unstable, pass `-Z install-upgrade` to enable it"
))?;
)
.into());
};

if args.is_present("list") {
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/core/compiler/fingerprint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,7 @@ pub fn translate_dep_info(
(DepInfoPathType::TargetRootRelative, &*file)
};
new_contents.push(ty as u8);
new_contents.extend(util::path2bytes(&path)?);
new_contents.extend(util::path2bytes(path)?);
new_contents.push(0);
}
paths::write(cargo_dep_info, &new_contents)?;
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/ops/cargo_package.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub struct PackageOpts<'cfg> {
pub no_default_features: bool,
}

static VCS_INFO_FILE: &'static str = ".cargo_vcs_info.json";
static VCS_INFO_FILE: &str = ".cargo_vcs_info.json";

pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult<Option<FileLock>> {
if ws.root().join("Cargo.lock").exists() {
Expand Down
4 changes: 2 additions & 2 deletions src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ pub enum CommandInfo {
impl CommandInfo {
pub fn name(&self) -> &str {
match self {
CommandInfo::BuiltIn { name, .. } => &name,
CommandInfo::External { name, .. } => &name,
CommandInfo::BuiltIn { name, .. } => name,
CommandInfo::External { name, .. } => name,
}
}
}
2 changes: 1 addition & 1 deletion src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,7 +1058,7 @@ impl TomlManifest {
.any(|t| t.name() == run)
{
let suggestion =
util::closest_msg(&run, targets.iter().filter(|t| t.is_bin()), |t| t.name());
util::closest_msg(run, targets.iter().filter(|t| t.is_bin()), |t| t.name());
bail!("default-run target `{}` not found{}", run, suggestion);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/workspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fn print_available(
writeln!(output, " {}", target.name())?;
}
}
Err(failure::err_msg(output))?
Err(failure::err_msg(output))
}

pub fn print_available_examples(
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/read_manifest.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::support::{basic_bin_manifest, main_file, project};

static MANIFEST_OUTPUT: &'static str = r#"
static MANIFEST_OUTPUT: &str = r#"
{
"authors": [
"wycats@example.com"
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/support/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1033,12 +1033,12 @@ impl Execs {
);

if let (Err(_), Err(_)) = (match_std, match_err) {
Err(format!(
return Err(format!(
"expected to find:\n\
{}\n\n\
did not find in either output.",
expect
))?;
));
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/support/paths.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::sync::Mutex;
use filetime::{self, FileTime};
use lazy_static::lazy_static;

static CARGO_INTEGRATION_TEST_DIR: &'static str = "cit";
static CARGO_INTEGRATION_TEST_DIR: &str = "cit";

lazy_static! {
static ref GLOBAL_ROOT: PathBuf = {
Expand Down
13 changes: 2 additions & 11 deletions tests/testsuite/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3062,17 +3062,8 @@ fn cargo_test_env() {

let cargo = cargo_exe().canonicalize().unwrap();
p.cargo("test --lib -- --nocapture")
.with_stderr_contains(format!(
"\
{}
",
cargo.to_str().unwrap()
))
.with_stdout_contains(format!(
"\
test env_test ... ok
",
))
.with_stderr_contains(cargo.to_str().unwrap())
.with_stdout_contains("test env_test ... ok")
.run();
}

Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/warn_on_failure.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::support::registry::Package;
use crate::support::{project, Project};

static WARNING1: &'static str = "Hello! I'm a warning. :)";
static WARNING2: &'static str = "And one more!";
static WARNING1: &str = "Hello! I'm a warning. :)";
static WARNING2: &str = "And one more!";

fn make_lib(lib_src: &str) {
Package::new("bar", "0.0.1")
Expand Down

0 comments on commit 7b84c53

Please sign in to comment.