File tree Expand file tree Collapse file tree 6 files changed +33
-35
lines changed Expand file tree Collapse file tree 6 files changed +33
-35
lines changed Original file line number Diff line number Diff line change @@ -52,9 +52,8 @@ impl RunnerCommand {
52
52
}
53
53
54
54
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" ) ) ?,
58
57
quiet,
59
58
runner_args,
60
59
} ) )
Original file line number Diff line number Diff line change @@ -31,12 +31,13 @@ pub fn main() -> Result<()> {
31
31
match BuildCommand :: parse_args ( raw_args) ? {
32
32
BuildCommand :: Build ( args) => build ( args) ,
33
33
BuildCommand :: Version => {
34
- help:: print_version ( ) ; Ok ( ( ) )
35
- } ,
34
+ help:: print_version ( ) ;
35
+ Ok ( ( ) )
36
+ }
36
37
BuildCommand :: Help => {
37
38
help:: print_cargo_bootimage_help ( ) ;
38
39
Ok ( ( ) )
39
- } ,
40
+ }
40
41
}
41
42
}
42
43
Original file line number Diff line number Diff line change @@ -25,13 +25,9 @@ impl BuildConfig {
25
25
) -> Result < Self , BootloaderError > {
26
26
let kernel_pkg = kernel_package ( project_metadata, kernel_bin_name) ?;
27
27
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
+ } ) ?;
35
31
36
32
let cargo_toml_content = fs:: read_to_string ( & bootloader_pkg. manifest_path )
37
33
. map_err ( |err| format ! ( "bootloader has no valid Cargo.toml: {}" , err) )
@@ -44,14 +40,13 @@ impl BuildConfig {
44
40
let target = metadata
45
41
. and_then ( |t| t. get ( "bootloader" ) )
46
42
. 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 (
51
45
"No `package.metadata.bootloader.target` key found in Cargo.toml of bootloader\n \n \
52
46
(If you're using the official bootloader crate, you need at least version 0.5.1)"
53
47
. into ( ) ,
54
- ) ) ?;
48
+ )
49
+ } ) ?;
55
50
56
51
let binary_feature = cargo_toml
57
52
. get ( "features" )
Original file line number Diff line number Diff line change @@ -168,13 +168,14 @@ impl Builder {
168
168
{
169
169
return Err ( BootloaderError :: BootloaderInvalid (
170
170
"bootloader has multiple executables" . into ( ) ,
171
- ) . into ( ) ) ;
171
+ )
172
+ . into ( ) ) ;
172
173
}
173
174
}
174
175
}
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
+ } ) ?;
178
179
179
180
disk_image:: create_disk_image ( & bootloader_elf_path, output_bin_path) ?;
180
181
Original file line number Diff line number Diff line change @@ -105,12 +105,14 @@ fn read_config_inner(manifest_path: &Path) -> Result<Config> {
105
105
}
106
106
config. test_args = Some ( args) ;
107
107
}
108
- ( key, value) => return Err ( anyhow ! (
109
- "unexpected `package.metadata.bootimage` \
108
+ ( key, value) => {
109
+ return Err ( anyhow ! (
110
+ "unexpected `package.metadata.bootimage` \
110
111
key `{}` with value `{}`",
111
- key,
112
- value
113
- ) ) ,
112
+ key,
113
+ value
114
+ ) )
115
+ }
114
116
}
115
117
}
116
118
Ok ( config. into ( ) )
@@ -128,11 +130,13 @@ struct ConfigBuilder {
128
130
impl Into < Config > for ConfigBuilder {
129
131
fn into ( self ) -> Config {
130
132
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
+ } ) ,
136
140
run_args : self . run_args ,
137
141
test_args : self . test_args ,
138
142
test_timeout : self . test_timeout . unwrap_or ( 60 * 5 ) ,
Original file line number Diff line number Diff line change @@ -68,9 +68,7 @@ pub(crate) fn runner(args: RunnerArgs) -> Result<i32> {
68
68
. file_name ( )
69
69
. ok_or_else ( || anyhow ! ( "kernel executable's parent has no file name" ) ) ?
70
70
. 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" ) ) ?
74
72
. starts_with ( "rustdoctest" ) ;
75
73
let is_test = is_doctest || exe_parent. ends_with ( "deps" ) ;
76
74
You can’t perform that action at this time.
0 commit comments