Skip to content

Commit

Permalink
chore: cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRustifyer committed Jul 14, 2024
1 parent 40ee054 commit 2f8a9d4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
10 changes: 2 additions & 8 deletions zork++/benches/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,9 @@ pub fn build_project_benchmark(c: &mut Criterion) {
let cli_args = CliArgs::parse();
let program_data = build_model(config, &cli_args, Path::new(".")).unwrap();
let mut cache = ZorkCache::default();

c.bench_function("Generate commands", |b| {
b.iter(|| {
generate_commands(
black_box(&program_data),
black_box(&mut cache),
&cli_args,
)
})
b.iter(|| generate_commands(black_box(&program_data), black_box(&mut cache), &cli_args))
});

c.bench_function("Cache loading time", |b| {
Expand Down
16 changes: 12 additions & 4 deletions zork++/src/lib/cli/output/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ impl<'a> From<&'a String> for Argument<'a> {
}

impl<'a> From<Cow<'a, str>> for Argument<'a> {
fn from(value: Cow<'a, str>) -> Self { Self(value) }
fn from(value: Cow<'a, str>) -> Self {
Self(value)
}
}

impl<'a> From<&Cow<'a, str>> for Argument<'a> {
Expand All @@ -52,11 +54,15 @@ impl<'a> From<String> for Argument<'a> {
}

impl<'a> From<&'a Path> for Argument<'a> {
fn from(value: &'a Path) -> Self { Self::from(value.to_string_lossy()) }
fn from(value: &'a Path) -> Self {
Self::from(value.to_string_lossy())
}
}

impl<'a> From<PathBuf> for Argument<'a> {
fn from(value: PathBuf) -> Self { Self::from(format!("{}", value.display())) }
fn from(value: PathBuf) -> Self {
Self::from(format!("{}", value.display()))
}
}

impl<'a> From<&PathBuf> for Argument<'a> {
Expand All @@ -66,7 +72,9 @@ impl<'a> From<&PathBuf> for Argument<'a> {
}

impl<'a> From<LanguageLevel> for Argument<'a> {
fn from(value: LanguageLevel) -> Self { Self::from(value.as_ref().to_string()) }
fn from(value: LanguageLevel) -> Self {
Self::from(value.as_ref().to_string())
}
}

impl<'a> Borrow<str> for Argument<'a> {
Expand Down

0 comments on commit 2f8a9d4

Please sign in to comment.