Skip to content

Commit d0622a4

Browse files
committed
chore: cargo fmt
1 parent ad7205c commit d0622a4

File tree

4 files changed

+41
-41
lines changed

4 files changed

+41
-41
lines changed

plugins/src/desktop_entries/mod.rs

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
mod graphics;
55

6+
use crate::desktop_entries::graphics::is_switchable;
67
use crate::*;
78
use freedesktop_desktop_entry::{default_paths, DesktopEntry, Iter as DesktopIter, PathSource};
89
use futures::StreamExt;
@@ -12,7 +13,6 @@ use std::hash::{Hash, Hasher};
1213
use std::process::Command;
1314
use tokio::io::AsyncWrite;
1415
use tracing::error;
15-
use crate::desktop_entries::graphics::is_switchable;
1616

1717
#[derive(Debug, Eq)]
1818
struct Item {
@@ -30,7 +30,7 @@ struct Item {
3030
#[derive(Debug, PartialEq, Eq)]
3131
pub enum ContextAction {
3232
Action(Action),
33-
GpuPreference(GpuPreference)
33+
GpuPreference(GpuPreference),
3434
}
3535

3636
impl Item {
@@ -39,18 +39,18 @@ impl Item {
3939
// No action provided just run the desktop entry with the default gpu
4040
None => run_exec_command(&self.exec, self.prefer_non_default_gpu),
4141
// Run the provided action
42-
Some(idx) => {
43-
match self.context.get(idx as usize) {
44-
None => error!("Could not find context action at index {idx}"),
45-
Some(action) => match action {
46-
ContextAction::Action(action) => run_exec_command(&action.exec, self.prefer_non_default_gpu),
47-
ContextAction::GpuPreference(pref) => match pref {
48-
GpuPreference::Default => run_exec_command(&self.exec, false),
49-
GpuPreference::NonDefault => run_exec_command(&self.exec, true),
50-
},
42+
Some(idx) => match self.context.get(idx as usize) {
43+
None => error!("Could not find context action at index {idx}"),
44+
Some(action) => match action {
45+
ContextAction::Action(action) => {
46+
run_exec_command(&action.exec, self.prefer_non_default_gpu)
47+
}
48+
ContextAction::GpuPreference(pref) => match pref {
49+
GpuPreference::Default => run_exec_command(&self.exec, false),
50+
GpuPreference::NonDefault => run_exec_command(&self.exec, true),
5151
},
52-
}
53-
}
52+
},
53+
},
5454
}
5555
}
5656
}
@@ -221,8 +221,8 @@ impl<W: AsyncWrite + Unpin> App<W> {
221221
let action =
222222
entry.action_name(action, locale).and_then(|name| {
223223
entry.action_exec(action).map(|exec| Action {
224-
name: action.to_string(),
225-
description: name.to_string(),
224+
name: name.to_string(),
225+
description: action.to_string(),
226226
exec: exec.to_string(),
227227
})
228228
});
@@ -238,19 +238,21 @@ impl<W: AsyncWrite + Unpin> App<W> {
238238
.map(|action| ContextAction::Action(action));
239239

240240
let entry_prefers_non_default_gpu = entry.prefers_non_default_gpu();
241-
let prefer_non_default_gpu = entry_prefers_non_default_gpu && is_switchable();
242-
let prefer_default_gpu = !entry_prefers_non_default_gpu && is_switchable();
241+
let prefer_non_default_gpu =
242+
entry_prefers_non_default_gpu && is_switchable();
243+
let prefer_default_gpu =
244+
!entry_prefers_non_default_gpu && is_switchable();
243245

244-
let context: Vec<ContextAction> = if prefer_non_default_gpu {
246+
let context: Vec<ContextAction> = if prefer_non_default_gpu {
245247
vec![ContextAction::GpuPreference(GpuPreference::Default)]
246248
} else if prefer_default_gpu {
247249
vec![ContextAction::GpuPreference(GpuPreference::NonDefault)]
248250
} else {
249251
vec![]
250252
}
251-
.into_iter()
252-
.chain(actions)
253-
.collect();
253+
.into_iter()
254+
.chain(actions)
255+
.collect();
254256

255257
let item = Item {
256258
appid: entry.appid.to_owned(),
@@ -267,7 +269,7 @@ impl<W: AsyncWrite + Unpin> App<W> {
267269
exec: exec.to_owned(),
268270
src,
269271
context,
270-
prefer_non_default_gpu: entry_prefers_non_default_gpu
272+
prefer_non_default_gpu: entry_prefers_non_default_gpu,
271273
};
272274

273275
deduplicator.insert(item);
@@ -312,22 +314,20 @@ impl<W: AsyncWrite + Unpin> App<W> {
312314
description: action.description.to_owned(),
313315
exec: Some(action.exec.to_string()),
314316
}),
315-
ContextAction::GpuPreference(pref) => {
316-
match pref {
317-
GpuPreference::Default => options.push(ContextOption {
318-
id: 0,
319-
name: "Integrated Graphics".to_owned(),
320-
description: "Launch Using Integrated Graphics Card".to_owned(),
321-
exec: None,
322-
}),
323-
GpuPreference::NonDefault => options.push(ContextOption {
324-
id: 0,
325-
name: "Discrete Graphics".to_owned(),
326-
description: "Launch Using Discrete Graphics Card".to_owned(),
327-
exec: None,
328-
}),
329-
}
330-
}
317+
ContextAction::GpuPreference(pref) => match pref {
318+
GpuPreference::Default => options.push(ContextOption {
319+
id: 0,
320+
name: "Integrated Graphics".to_owned(),
321+
description: "Launch Using Integrated Graphics Card".to_owned(),
322+
exec: None,
323+
}),
324+
GpuPreference::NonDefault => options.push(ContextOption {
325+
id: 0,
326+
name: "Discrete Graphics".to_owned(),
327+
description: "Launch Using Discrete Graphics Card".to_owned(),
328+
exec: None,
329+
}),
330+
},
331331
}
332332
}
333333

plugins/src/web/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use url::Url;
1212

1313
use pop_launcher::*;
1414

15-
pub use config::{Config, Definition, load};
15+
pub use config::{load, Config, Definition};
1616
use regex::Regex;
1717

1818
mod config;

service/src/plugins/help.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub const CONFIG: PluginConfig = PluginConfig {
2323
regex: None,
2424
},
2525
icon: Some(IconSource::Name(Cow::Borrowed("system-help-symbolic"))),
26-
history: false
26+
history: false,
2727
};
2828
pub struct HelpPlugin {
2929
pub id: usize,

service/src/plugins/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright 2021 System76 <[email protected]>
22
// SPDX-License-Identifier: MPL-2.0
33

4-
pub(crate) mod external;
54
pub mod config;
5+
pub(crate) mod external;
66
pub mod help;
77

88
pub use external::load;

0 commit comments

Comments
 (0)