Skip to content

Commit ebfd09a

Browse files
committed
Run cargo clippy --fix
1 parent 79064d5 commit ebfd09a

File tree

6 files changed

+14
-16
lines changed

6 files changed

+14
-16
lines changed

src/args/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl BuildCommand {
3232
Ok(())
3333
};
3434

35-
let mut arg_iter = args.into_iter();
35+
let mut arg_iter = args;
3636
while let Some(arg) = arg_iter.next() {
3737
match arg.as_ref() {
3838
"--help" | "-h" => {

src/args/runner.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ impl RunnerCommand {
2121
let mut quiet = false;
2222
let mut runner_args = None;
2323

24-
let mut arg_iter = args.into_iter().fuse();
24+
let mut arg_iter = args.fuse();
2525

2626
loop {
2727
if executable.is_some() {
2828
let args: Vec<_> = arg_iter.collect();
29-
if args.len() > 0 {
29+
if !args.is_empty() {
3030
runner_args = Some(args);
3131
}
3232
break;

src/bin/cargo-bootimage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ fn build(args: BuildArgs) -> Result<()> {
4040
let quiet = args.quiet();
4141

4242
let executables = builder.build_kernel(&args.cargo_args(), quiet)?;
43-
if executables.len() == 0 {
43+
if executables.is_empty() {
4444
return Err(anyhow!("no executables built"));
4545
}
4646

src/builder/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,9 @@ impl Builder {
166166
.replace(PathBuf::from(executable))
167167
.is_some()
168168
{
169-
Err(BootloaderError::BootloaderInvalid(
169+
return Err(BootloaderError::BootloaderInvalid(
170170
"bootloader has multiple executables".into(),
171-
))?;
171+
).into());
172172
}
173173
}
174174
}

src/config.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn read_config_inner(manifest_path: &Path) -> Result<Config> {
6767
for (key, value) in metadata {
6868
match (key.as_str(), value.clone()) {
6969
("test-timeout", Value::Integer(timeout)) if timeout.is_negative() => {
70-
Err(anyhow!("test-timeout must not be negative"))?
70+
return Err(anyhow!("test-timeout must not be negative"))
7171
}
7272
("test-timeout", Value::Integer(timeout)) => {
7373
config.test_timeout = Some(timeout as u32);
@@ -80,7 +80,7 @@ fn read_config_inner(manifest_path: &Path) -> Result<Config> {
8080
for value in array {
8181
match value {
8282
Value::String(s) => command.push(s),
83-
_ => Err(anyhow!("run-command must be a list of strings"))?,
83+
_ => return Err(anyhow!("run-command must be a list of strings")),
8484
}
8585
}
8686
config.run_command = Some(command);
@@ -90,7 +90,7 @@ fn read_config_inner(manifest_path: &Path) -> Result<Config> {
9090
for value in array {
9191
match value {
9292
Value::String(s) => args.push(s),
93-
_ => Err(anyhow!("run-args must be a list of strings"))?,
93+
_ => return Err(anyhow!("run-args must be a list of strings")),
9494
}
9595
}
9696
config.run_args = Some(args);
@@ -100,17 +100,17 @@ fn read_config_inner(manifest_path: &Path) -> Result<Config> {
100100
for value in array {
101101
match value {
102102
Value::String(s) => args.push(s),
103-
_ => Err(anyhow!("test-args must be a list of strings"))?,
103+
_ => return Err(anyhow!("test-args must be a list of strings")),
104104
}
105105
}
106106
config.test_args = Some(args);
107107
}
108-
(key, value) => Err(anyhow!(
108+
(key, value) => return Err(anyhow!(
109109
"unexpected `package.metadata.bootimage` \
110110
key `{}` with value `{}`",
111111
key,
112112
value
113-
))?,
113+
)),
114114
}
115115
}
116116
Ok(config.into())

src/main.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,8 @@ pub(crate) fn runner(args: RunnerArgs) -> Result<i32> {
104104
if let Some(args) = config.test_args {
105105
run_command.extend(args);
106106
}
107-
} else {
108-
if let Some(args) = config.run_args {
109-
run_command.extend(args);
110-
}
107+
} else if let Some(args) = config.run_args {
108+
run_command.extend(args);
111109
}
112110
if let Some(args) = args.runner_args {
113111
run_command.extend(args);

0 commit comments

Comments
 (0)