Skip to content

Commit a11478f

Browse files
author
Deren Vural
committed
trunk formatting
Signed-off-by: Deren Vural <[email protected]>
1 parent b74e650 commit a11478f

File tree

4 files changed

+37
-21
lines changed

4 files changed

+37
-21
lines changed

install_schemas.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,20 @@ SCHEMA_DIR="$HOME/.local/share/glib-2.0/schemas"
2525
SCHEMA_FILE="com.gtk_d.NvidiaMonitorRust.gschema.xml"
2626

2727
# Create schema directory if it doesn't exist
28-
if [[ -d "$SCHEMA_DIR" ]]; then
29-
echo "$SCHEMA_DIR already exists.."
28+
if [[ -d $SCHEMA_DIR ]]; then
29+
echo "$SCHEMA_DIR already exists.."
3030
else
31-
echo "$SCHEMA_DIR needs created.."
32-
mkdir -p "$SCHEMA_DIR"
31+
echo "$SCHEMA_DIR needs created.."
32+
mkdir -p "$SCHEMA_DIR"
3333
fi
3434

3535
# Copy schema file across
3636
if [[ -f "$SCHEMA_DIR/$SCHEMA_FILE" ]]; then
37-
echo "$SCHEMA_FILE already exists, overwriting.."
38-
cp "./src/$SCHEMA_FILE" "$SCHEMA_DIR/"
37+
echo "$SCHEMA_FILE already exists, overwriting.."
38+
cp "./src/$SCHEMA_FILE" "$SCHEMA_DIR/"
3939
else
40-
echo "$SCHEMA_FILE needs copied to $SCHEMA_DIR.."
41-
cp "./src/$SCHEMA_FILE" "$SCHEMA_DIR/"
40+
echo "$SCHEMA_FILE needs copied to $SCHEMA_DIR.."
41+
cp "./src/$SCHEMA_FILE" "$SCHEMA_DIR/"
4242
fi
4343

4444
# Compile schemas

src/mainwindow/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ impl MainWindow {
533533
let settings: &Settings = window.settings();
534534

535535
// Get state from settings
536-
settings_window_container.open = settings.boolean("app-settings-open").clone();
536+
settings_window_container.open = settings.boolean("app-settings-open");
537537

538538
// Check if an object is stored
539539
match &settings_window_container.window {

src/provider/imp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,9 @@ impl ObjectImpl for Provider {
229229
}
230230
"provider-type" => {
231231
//TODO: this seems ridiculous..
232-
let value = self.provider_type.take();
232+
let value = self.provider_type.get();
233233

234-
self.provider_type.set(value.clone());
234+
self.provider_type.set(value);
235235

236236
value.to_value()
237237
}

src/provider/mod.rs

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ impl Provider {
8282

8383
// Set properties
8484
let properties: Vec<Property> = func();
85-
if properties.len() != 0 {
85+
if !properties.is_empty() {
8686
obj.set_property("utilization-property", properties[0].clone());
8787
obj.set_property("temperature-property", properties[1].clone());
8888
obj.set_property("memory-usage-property", properties[2].clone());
@@ -121,19 +121,31 @@ impl Provider {
121121
match self.property::<i32>("provider-type") {
122122
// Nvidia Settings/SMI
123123
0 => {
124-
processor_args = ["nvidia-settings", "-q GpuUUID -t"];
124+
processor_args = [
125+
"nvidia-settings",
126+
"-q GpuUUID -t"
127+
];
125128
}
126129
// Nvidia Settings
127130
1 => {
128-
processor_args = ["nvidia-settings", "-q GpuUUID -t"];
131+
processor_args = [
132+
"nvidia-settings",
133+
"-q GpuUUID -t"
134+
];
129135
}
130136
// Nvidia SMI
131137
2 => {
132-
processor_args = ["nvidia-smi", "--query-gpu=gpu_name --format=csv,noheader"];
138+
processor_args = [
139+
"nvidia-smi",
140+
"--query-gpu=gpu_name --format=csv,noheader"
141+
];
133142
}
134143
// Nvidia Optimus
135144
3 => {
136-
processor_args = ["optirun", "nvidia-smi --query-gpu=gpu_name --format=csv,noheader"];
145+
processor_args = [
146+
"optirun",
147+
"nvidia-smi --query-gpu=gpu_name --format=csv,noheader"
148+
];
137149
}
138150
_ => {
139151
// Return error..
@@ -227,7 +239,11 @@ impl Provider {
227239
* Notes:
228240
*
229241
*/
230-
pub fn update_property_value<T: ToValue + std::marker::Copy>(&self, property_name: &str, value: T) -> Result<(),String>{
242+
pub fn update_property_value<T: ToValue + std::marker::Copy>(
243+
&self,
244+
property_name: &str,
245+
value: T
246+
) -> Result<(),String>{
231247
// Fetch the list of properties (dependant on provider type)
232248
match self.property::<i32>("provider-type") {
233249
1 => {
@@ -266,8 +282,8 @@ impl Provider {
266282
}
267283

268284
// Return sucess
269-
return Ok(());
270-
},
285+
Ok(())
286+
}
271287
_ => {
272288
// Fetch list
273289
let properties: [Property; 5] = [
@@ -308,8 +324,8 @@ impl Provider {
308324
}
309325

310326
// Return sucess
311-
return Ok(());
312-
},
327+
Ok(())
328+
}
313329
}
314330
}
315331
}

0 commit comments

Comments
 (0)