Skip to content

Commit

Permalink
fix: enable flags.enable_gpu by default
Browse files Browse the repository at this point in the history
  • Loading branch information
shurizzle committed Aug 13, 2024
1 parent d9d9e1d commit 9c4b973
Showing 1 changed file with 19 additions and 11 deletions.
30 changes: 19 additions & 11 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -806,19 +806,20 @@ fn get_use_battery(args: &BottomArgs, config: &Config) -> bool {
false
}

#[allow(unused_variables)]
#[cfg(feature = "gpu")]
fn get_enable_gpu(args: &BottomArgs, config: &Config) -> bool {
#[cfg(feature = "gpu")]
{
if args.gpu.enable_gpu {
return true;
} else if let Some(flags) = &config.flags {
if let Some(enable_gpu) = flags.enable_gpu {
return enable_gpu;
}
}
if args.gpu.enable_gpu {
return true;
}
config
.flags
.as_ref()
.and_then(|f| f.enable_gpu)
.unwrap_or(true)
}

#[cfg(not(feature = "gpu"))]
fn get_enable_gpu(_: &BottomArgs, _: &Config) -> bool {
false
}

Expand Down Expand Up @@ -1149,7 +1150,14 @@ mod test {

// Skip battery since it's tricky to test depending on the platform/features
// we're testing with.
let skip = ["help", "version", "celsius", "battery", "generate_schema"];
let skip = [
"help",
"version",
"celsius",
"battery",
"generate_schema",
"enable_gpu",
];

for arg in app.get_arguments().collect::<Vec<_>>() {
let arg_name = arg
Expand Down

0 comments on commit 9c4b973

Please sign in to comment.