Skip to content

Commit f03598b

Browse files
committed
Run cargo fmt
1 parent 3d5adf8 commit f03598b

File tree

3 files changed

+40
-29
lines changed

3 files changed

+40
-29
lines changed

cobalt-build/src/build.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,13 @@ fn build_file_2(
162162
inkwell::targets::CodeModel::Small,
163163
)
164164
.expect("failed to create target machine");
165-
ctx.module.run_passes(
166-
&opt::expand_pass_string(&opts.profile)?,
167-
&target_machine,
168-
PassBuilderOptions::create(),
169-
).map_err(opt::PassError::from_llvm)?;
165+
ctx.module
166+
.run_passes(
167+
&opt::expand_pass_string(&opts.profile)?,
168+
&target_machine,
169+
PassBuilderOptions::create(),
170+
)
171+
.map_err(opt::PassError::from_llvm)?;
170172
if !out_path.parent().unwrap().exists() {
171173
out_path.parent().unwrap().create_dir_all_anyhow()?
172174
}

cobalt-build/src/opt.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
use std::path::PathBuf;
21
use anyhow_std::*;
32
use std::env::var_os;
3+
use std::path::PathBuf;
44
use thiserror::Error;
55

66
/// A profile wasn't found in any of the searched paths
@@ -57,8 +57,9 @@ fn expand_profile_name(name: &str) -> anyhow::Result<String> {
5757
"less" | "1" => "default<O1>",
5858
"some" | "2" | "default" => "default<O2>",
5959
"aggr" | "3" => "default<O3>",
60-
_ => Err(MissingProfile(name.to_string()))?
61-
}.to_string())
60+
_ => Err(MissingProfile(name.to_string()))?,
61+
}
62+
.to_string())
6263
}
6364

6465
fn non_ident(ch: char) -> bool {

cobalt-cli/src/lib.rs

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -819,7 +819,7 @@ pub fn driver(cli: Cli) -> anyhow::Result<()> {
819819
path.set_extension(suffix);
820820
}
821821
false
822-
},
822+
}
823823
OutputType::Llvm => path.set_extension("ll"),
824824
OutputType::Bitcode => path.set_extension("bc"),
825825
OutputType::Assembly => path.set_extension("s"),
@@ -904,11 +904,13 @@ pub fn driver(cli: Cli) -> anyhow::Result<()> {
904904
reporter.insts_before = insts(&ctx.module);
905905
reporter.opt_time = Some(
906906
try_timeit(|| {
907-
ctx.module.run_passes(
908-
&opt::expand_pass_string(profile.as_deref().unwrap_or("@default"))?,
909-
&target_machine,
910-
PassBuilderOptions::create(),
911-
).map_err(opt::PassError::from_llvm)?;
907+
ctx.module
908+
.run_passes(
909+
&opt::expand_pass_string(profile.as_deref().unwrap_or("@default"))?,
910+
&target_machine,
911+
PassBuilderOptions::create(),
912+
)
913+
.map_err(opt::PassError::from_llvm)?;
912914
anyhow::Ok(())
913915
})?
914916
.1,
@@ -1243,11 +1245,13 @@ pub fn driver(cli: Cli) -> anyhow::Result<()> {
12431245
reporter.insts_before = insts(&ctx.module);
12441246
reporter.opt_time = Some(
12451247
try_timeit(|| {
1246-
ctx.module.run_passes(
1247-
&opt::expand_pass_string(profile.as_deref().unwrap_or("@default"))?,
1248-
&target_machine,
1249-
PassBuilderOptions::create(),
1250-
).map_err(opt::PassError::from_llvm)?;
1248+
ctx.module
1249+
.run_passes(
1250+
&opt::expand_pass_string(profile.as_deref().unwrap_or("@default"))?,
1251+
&target_machine,
1252+
PassBuilderOptions::create(),
1253+
)
1254+
.map_err(opt::PassError::from_llvm)?;
12511255
anyhow::Ok(())
12521256
})?
12531257
.1,
@@ -1756,11 +1760,13 @@ pub fn driver(cli: Cli) -> anyhow::Result<()> {
17561760
}
17571761
reporter.insts_before += insts(&ctx.module);
17581762
*reporter.opt_time.get_or_insert(Duration::ZERO) += try_timeit(|| {
1759-
ctx.module.run_passes(
1760-
&pass_str,
1761-
&target_machine,
1762-
PassBuilderOptions::create(),
1763-
).map_err(opt::PassError::from_llvm)?;
1763+
ctx.module
1764+
.run_passes(
1765+
&pass_str,
1766+
&target_machine,
1767+
PassBuilderOptions::create(),
1768+
)
1769+
.map_err(opt::PassError::from_llvm)?;
17641770
anyhow::Ok(())
17651771
})?
17661772
.1;
@@ -2173,11 +2179,13 @@ pub fn driver(cli: Cli) -> anyhow::Result<()> {
21732179
reporter.insts_before = insts(&ctx.module);
21742180
*reporter.opt_time.get_or_insert(Duration::ZERO) += try_timeit(|| {
21752181
reporter.insts_before += insts(&ctx.module);
2176-
ctx.module.run_passes(
2177-
&opt::expand_pass_string(profile.as_deref().unwrap_or("@default"))?,
2178-
&target_machine,
2179-
PassBuilderOptions::create(),
2180-
).map_err(opt::PassError::from_llvm)?;
2182+
ctx.module
2183+
.run_passes(
2184+
&opt::expand_pass_string(profile.as_deref().unwrap_or("@default"))?,
2185+
&target_machine,
2186+
PassBuilderOptions::create(),
2187+
)
2188+
.map_err(opt::PassError::from_llvm)?;
21812189
anyhow::Ok(())
21822190
})?
21832191
.1;

0 commit comments

Comments
 (0)