Skip to content

Commit 9fa6560

Browse files
committed
Fix some clippy warnings.
1 parent 705009e commit 9fa6560

File tree

12 files changed

+18
-26
lines changed

12 files changed

+18
-26
lines changed

src/bin/cargo/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn main(config: &mut Config) -> CliResult {
1919
return super::execute_external_subcommand(config, cmd, &[cmd, "--help"])
2020
.map_err(|_| e.into());
2121
} else {
22-
return Err(e)?;
22+
return Err(e.into());
2323
}
2424
}
2525
};

src/bin/cargo/commands/install.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,10 @@ pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
153153
let root = args.value_of("root");
154154

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

161162
if args.is_present("list") {

src/cargo/core/compiler/fingerprint.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,7 @@ pub fn translate_dep_info(
15771577
(DepInfoPathType::TargetRootRelative, &*file)
15781578
};
15791579
new_contents.push(ty as u8);
1580-
new_contents.extend(util::path2bytes(&path)?);
1580+
new_contents.extend(util::path2bytes(path)?);
15811581
new_contents.push(0);
15821582
}
15831583
paths::write(cargo_dep_info, &new_contents)?;

src/cargo/ops/cargo_package.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub struct PackageOpts<'cfg> {
3939
pub no_default_features: bool,
4040
}
4141

42-
static VCS_INFO_FILE: &'static str = ".cargo_vcs_info.json";
42+
static VCS_INFO_FILE: &str = ".cargo_vcs_info.json";
4343

4444
pub fn package(ws: &Workspace<'_>, opts: &PackageOpts<'_>) -> CargoResult<Option<FileLock>> {
4545
if ws.root().join("Cargo.lock").exists() {

src/cargo/util/command_prelude.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@ pub enum CommandInfo {
515515
impl CommandInfo {
516516
pub fn name(&self) -> &str {
517517
match self {
518-
CommandInfo::BuiltIn { name, .. } => &name,
519-
CommandInfo::External { name, .. } => &name,
518+
CommandInfo::BuiltIn { name, .. } => name,
519+
CommandInfo::External { name, .. } => name,
520520
}
521521
}
522522
}

src/cargo/util/toml/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1058,7 +1058,7 @@ impl TomlManifest {
10581058
.any(|t| t.name() == run)
10591059
{
10601060
let suggestion =
1061-
util::closest_msg(&run, targets.iter().filter(|t| t.is_bin()), |t| t.name());
1061+
util::closest_msg(run, targets.iter().filter(|t| t.is_bin()), |t| t.name());
10621062
bail!("default-run target `{}` not found{}", run, suggestion);
10631063
}
10641064
}

src/cargo/util/workspace.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ fn print_available(
4646
writeln!(output, " {}", target.name())?;
4747
}
4848
}
49-
Err(failure::err_msg(output))?
49+
Err(failure::err_msg(output))
5050
}
5151

5252
pub fn print_available_examples(

tests/testsuite/read_manifest.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::support::{basic_bin_manifest, main_file, project};
22

3-
static MANIFEST_OUTPUT: &'static str = r#"
3+
static MANIFEST_OUTPUT: &str = r#"
44
{
55
"authors": [
66
"wycats@example.com"

tests/testsuite/support/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,12 +1033,12 @@ impl Execs {
10331033
);
10341034

10351035
if let (Err(_), Err(_)) = (match_std, match_err) {
1036-
Err(format!(
1036+
return Err(format!(
10371037
"expected to find:\n\
10381038
{}\n\n\
10391039
did not find in either output.",
10401040
expect
1041-
))?;
1041+
));
10421042
}
10431043
}
10441044

tests/testsuite/support/paths.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::sync::Mutex;
1010
use filetime::{self, FileTime};
1111
use lazy_static::lazy_static;
1212

13-
static CARGO_INTEGRATION_TEST_DIR: &'static str = "cit";
13+
static CARGO_INTEGRATION_TEST_DIR: &str = "cit";
1414

1515
lazy_static! {
1616
static ref GLOBAL_ROOT: PathBuf = {

0 commit comments

Comments
 (0)