Skip to content

Commit

Permalink
Avoid some unnecessary returns.
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurentMazare committed Jan 8, 2024
1 parent ad075a5 commit fb05af4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions candle-core/benches/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,21 @@ impl BenchDevice for Device {
}

pub(crate) fn device() -> Result<Device> {
return if cfg!(feature = "metal") {
if cfg!(feature = "metal") {
Device::new_metal(0)
} else if cfg!(feature = "cuda") {
Device::new_cuda(0)
} else {
Ok(Device::Cpu)
};
}
}

pub(crate) fn bench_name<S: Into<String>>(name: S) -> String {
format!("{}_{}", device_variant(), name.into())
}

const fn device_variant() -> &'static str {
return if cfg!(feature = "metal") {
if cfg!(feature = "metal") {
"metal"
} else if cfg!(feature = "cuda") {
"cuda"
Expand All @@ -49,5 +49,5 @@ const fn device_variant() -> &'static str {
"mkl"
} else {
"cpu"
};
}
}

0 comments on commit fb05af4

Please sign in to comment.