Skip to content

Commit 120d6e6

Browse files
committed
Run cargo fmt
1 parent e88d340 commit 120d6e6

File tree

6 files changed

+33
-35
lines changed

6 files changed

+33
-35
lines changed

src/args/runner.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ impl RunnerCommand {
5252
}
5353

5454
Ok(Self::Runner(RunnerArgs {
55-
executable: executable.ok_or_else(|| anyhow!(
56-
"excepted path to kernel executable as first argument"
57-
))?,
55+
executable: executable
56+
.ok_or_else(|| anyhow!("excepted path to kernel executable as first argument"))?,
5857
quiet,
5958
runner_args,
6059
}))

src/bin/cargo-bootimage.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,13 @@ pub fn main() -> Result<()> {
3131
match BuildCommand::parse_args(raw_args)? {
3232
BuildCommand::Build(args) => build(args),
3333
BuildCommand::Version => {
34-
help::print_version(); Ok(())
35-
},
34+
help::print_version();
35+
Ok(())
36+
}
3637
BuildCommand::Help => {
3738
help::print_cargo_bootimage_help();
3839
Ok(())
39-
},
40+
}
4041
}
4142
}
4243

src/builder/bootloader.rs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,9 @@ impl BuildConfig {
2525
) -> Result<Self, BootloaderError> {
2626
let kernel_pkg = kernel_package(project_metadata, kernel_bin_name)?;
2727
let bootloader_pkg = bootloader_package(project_metadata, kernel_pkg)?;
28-
let bootloader_root =
29-
bootloader_pkg
30-
.manifest_path
31-
.parent()
32-
.ok_or_else(|| BootloaderError::BootloaderInvalid(
33-
"bootloader manifest has no target directory".into(),
34-
))?;
28+
let bootloader_root = bootloader_pkg.manifest_path.parent().ok_or_else(|| {
29+
BootloaderError::BootloaderInvalid("bootloader manifest has no target directory".into())
30+
})?;
3531

3632
let cargo_toml_content = fs::read_to_string(&bootloader_pkg.manifest_path)
3733
.map_err(|err| format!("bootloader has no valid Cargo.toml: {}", err))
@@ -44,14 +40,13 @@ impl BuildConfig {
4440
let target = metadata
4541
.and_then(|t| t.get("bootloader"))
4642
.and_then(|t| t.get("target"));
47-
let target_str =
48-
target
49-
.and_then(|v| v.as_str())
50-
.ok_or_else(|| BootloaderError::BootloaderInvalid(
43+
let target_str = target.and_then(|v| v.as_str()).ok_or_else(|| {
44+
BootloaderError::BootloaderInvalid(
5145
"No `package.metadata.bootloader.target` key found in Cargo.toml of bootloader\n\n\
5246
(If you're using the official bootloader crate, you need at least version 0.5.1)"
5347
.into(),
54-
))?;
48+
)
49+
})?;
5550

5651
let binary_feature = cargo_toml
5752
.get("features")

src/builder/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,14 @@ impl Builder {
168168
{
169169
return Err(BootloaderError::BootloaderInvalid(
170170
"bootloader has multiple executables".into(),
171-
).into());
171+
)
172+
.into());
172173
}
173174
}
174175
}
175-
let bootloader_elf_path = bootloader_elf_path.ok_or_else(|| BootloaderError::BootloaderInvalid(
176-
"bootloader has no executable".into(),
177-
))?;
176+
let bootloader_elf_path = bootloader_elf_path.ok_or_else(|| {
177+
BootloaderError::BootloaderInvalid("bootloader has no executable".into())
178+
})?;
178179

179180
disk_image::create_disk_image(&bootloader_elf_path, output_bin_path)?;
180181

src/config.rs

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,14 @@ fn read_config_inner(manifest_path: &Path) -> Result<Config> {
105105
}
106106
config.test_args = Some(args);
107107
}
108-
(key, value) => return Err(anyhow!(
109-
"unexpected `package.metadata.bootimage` \
108+
(key, value) => {
109+
return Err(anyhow!(
110+
"unexpected `package.metadata.bootimage` \
110111
key `{}` with value `{}`",
111-
key,
112-
value
113-
)),
112+
key,
113+
value
114+
))
115+
}
114116
}
115117
}
116118
Ok(config.into())
@@ -128,11 +130,13 @@ struct ConfigBuilder {
128130
impl Into<Config> for ConfigBuilder {
129131
fn into(self) -> Config {
130132
Config {
131-
run_command: self.run_command.unwrap_or_else(|| vec![
132-
"qemu-system-x86_64".into(),
133-
"-drive".into(),
134-
"format=raw,file={}".into(),
135-
]),
133+
run_command: self.run_command.unwrap_or_else(|| {
134+
vec![
135+
"qemu-system-x86_64".into(),
136+
"-drive".into(),
137+
"format=raw,file={}".into(),
138+
]
139+
}),
136140
run_args: self.run_args,
137141
test_args: self.test_args,
138142
test_timeout: self.test_timeout.unwrap_or(60 * 5),

src/main.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ pub(crate) fn runner(args: RunnerArgs) -> Result<i32> {
6868
.file_name()
6969
.ok_or_else(|| anyhow!("kernel executable's parent has no file name"))?
7070
.to_str()
71-
.ok_or_else(|| anyhow!(
72-
"kernel executable's parent file name is not valid UTF-8"
73-
))?
71+
.ok_or_else(|| anyhow!("kernel executable's parent file name is not valid UTF-8"))?
7472
.starts_with("rustdoctest");
7573
let is_test = is_doctest || exe_parent.ends_with("deps");
7674

0 commit comments

Comments
 (0)