Skip to content

Commit f0ee6f7

Browse files
committed
cargo fmt + cargo fix
1 parent b46e62a commit f0ee6f7

20 files changed

+213
-201
lines changed

src/backends/desktop_file.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,7 @@ pub fn parse_desktop_file(content: &str) -> anyhow::Result<DesktopEntry> {
4242
let exec = exec.ok_or_else(|| anyhow::anyhow!("Missing Exec key"))?;
4343
let icon = icon.unwrap_or_default();
4444

45-
Ok(DesktopEntry {
46-
name,
47-
icon,
48-
exec,
49-
})
45+
Ok(DesktopEntry { name, icon, exec })
5046
}
5147

5248
#[cfg(test)]

src/backends/distrobox/distrobox.rs

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -510,11 +510,7 @@ impl DistroboxCommandRunnerResponse {
510510
Categories=Utility;Network;",
511511
name, name, icon
512512
);
513-
toml.push_str(&format!(
514-
"\"{}\"=\"{}\"\n",
515-
to_hex(&path),
516-
to_hex(&content)
517-
));
513+
toml.push_str(&format!("\"{}\"=\"{}\"\n", to_hex(&path), to_hex(&content)));
518514
}
519515

520516
toml.push_str("[user]\n");
@@ -1124,7 +1120,7 @@ d24405b14180 | ubuntu | Created | ghcr.io/ublue-os/ubun
11241120
NullCommandRunnerBuilder::new()
11251121
.cmd(&["distrobox", "ls", "--no-color"], output)
11261122
.build(),
1127-
default_cmd_factory()
1123+
default_cmd_factory(),
11281124
);
11291125
assert_eq!(
11301126
db.list().await?,
@@ -1150,8 +1146,7 @@ d24405b14180 | ubuntu | Created | ghcr.io/ublue-os/ubun
11501146
NullCommandRunnerBuilder::new()
11511147
.cmd(&["distrobox", "version"], output)
11521148
.build(),
1153-
default_cmd_factory()
1154-
1149+
default_cmd_factory(),
11551150
);
11561151
assert_eq!(db.version().await?, "1.7.2.1".to_string(),);
11571152
Ok(())
@@ -1206,8 +1201,7 @@ Categories=Utility;Network;";
12061201
&desktop_files_toml,
12071202
)
12081203
.build(),
1209-
default_cmd_factory()
1210-
1204+
default_cmd_factory(),
12111205
);
12121206

12131207
let apps = block_on(db.list_apps("ubuntu"))?;
@@ -1260,8 +1254,7 @@ Categories=Utility;Security;";
12601254
&desktop_files_toml,
12611255
)
12621256
.build(),
1263-
default_cmd_factory()
1264-
1257+
default_cmd_factory(),
12651258
);
12661259

12671260
let apps = block_on(db.list_apps("ubuntu"))?;
@@ -1366,8 +1359,8 @@ Categories=Utility;Security;";
13661359
let toml_output = toml_command.1().expect("Should generate output");
13671360

13681361
// Verify the TOML is parseable
1369-
let desktop_files: DesktopFiles = toml::from_str(&toml_output)
1370-
.expect("Generated TOML should be valid and parseable");
1362+
let desktop_files: DesktopFiles =
1363+
toml::from_str(&toml_output).expect("Generated TOML should be valid and parseable");
13711364

13721365
// Verify home_dir is set
13731366
assert_eq!(
@@ -1445,10 +1438,7 @@ Categories=Utility;Security;";
14451438
Status::Exited("(0) 10 seconds ago".to_string()).to_string(),
14461439
"Exited (0) 10 seconds ago"
14471440
);
1448-
assert_eq!(
1449-
Status::Other("Unknown".to_string()).to_string(),
1450-
"Unknown"
1451-
);
1441+
assert_eq!(Status::Other("Unknown".to_string()).to_string(), "Unknown");
14521442
}
14531443

14541444
#[test]
@@ -1506,7 +1496,8 @@ Categories=Utility;Security;";
15061496
assert_eq!(info.image, "docker.io/library/ubuntu:latest");
15071497

15081498
// Test container with "Created" status
1509-
let line = "def456 | fedora | Created 2 minutes ago | ghcr.io/ublue-os/fedora-toolbox:latest";
1499+
let line =
1500+
"def456 | fedora | Created 2 minutes ago | ghcr.io/ublue-os/fedora-toolbox:latest";
15101501
let info = ContainerInfo::from_str(line)?;
15111502
assert_eq!(info.id, "def456");
15121503
assert_eq!(info.name, "fedora");

src/backends/flatpak.rs

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod tests {
1717
fn test_map_flatpak_spawn_host_simple() {
1818
let cmd = Command::new("ls");
1919
let mapped = map_flatpak_spawn_host(cmd);
20-
20+
2121
assert_eq!(mapped.program.to_string_lossy(), "flatpak-spawn");
2222
assert_eq!(mapped.args.len(), 2);
2323
assert_eq!(mapped.args[0].to_string_lossy(), "--host");
@@ -28,9 +28,9 @@ mod tests {
2828
fn test_map_flatpak_spawn_host_with_args() {
2929
let mut cmd = Command::new("distrobox");
3030
cmd.args(["ls", "--no-color"]);
31-
31+
3232
let mapped = map_flatpak_spawn_host(cmd);
33-
33+
3434
assert_eq!(mapped.program.to_string_lossy(), "flatpak-spawn");
3535
assert_eq!(mapped.args.len(), 4);
3636
assert_eq!(mapped.args[0].to_string_lossy(), "--host");
@@ -43,26 +43,25 @@ mod tests {
4343
fn test_map_flatpak_spawn_host_display() {
4444
let mut cmd = Command::new("podman");
4545
cmd.args(["ps", "-a"]);
46-
46+
4747
let mapped = map_flatpak_spawn_host(cmd);
4848
let display = format!("{}", mapped);
49-
49+
5050
assert_eq!(display, "flatpak-spawn --host podman ps -a");
5151
}
5252

5353
#[test]
5454
fn test_map_flatpak_spawn_host_preserves_fd_modes() {
5555
use crate::fakers::FdMode;
56-
56+
5757
let mut cmd = Command::new("echo");
5858
cmd.stdout = FdMode::Pipe;
5959
cmd.stderr = FdMode::Pipe;
60-
60+
6161
let mapped = map_flatpak_spawn_host(cmd);
62-
62+
6363
// FdMode should be preserved
6464
matches!(mapped.stdout, FdMode::Pipe);
6565
matches!(mapped.stderr, FdMode::Pipe);
6666
}
6767
}
68-

src/backends/podman.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,17 @@ mod tests {
145145
fn test_map_docker_to_podman() {
146146
let cmd = Command::new("docker");
147147
let mapped = map_docker_to_podman(cmd);
148-
148+
149149
assert_eq!(mapped.program.to_string_lossy(), "podman");
150150
}
151151

152152
#[test]
153153
fn test_map_docker_to_podman_with_args() {
154154
let mut cmd = Command::new("docker");
155155
cmd.args(["ps", "-a"]);
156-
156+
157157
let mapped = map_docker_to_podman(cmd);
158-
158+
159159
assert_eq!(mapped.program.to_string_lossy(), "podman");
160160
assert_eq!(mapped.args[0].to_string_lossy(), "ps");
161161
assert_eq!(mapped.args[1].to_string_lossy(), "-a");
@@ -165,7 +165,7 @@ mod tests {
165165
fn test_map_docker_to_podman_non_docker() {
166166
let cmd = Command::new("other-command");
167167
let mapped = map_docker_to_podman(cmd);
168-
168+
169169
// Non-docker commands should not be changed
170170
assert_eq!(mapped.program.to_string_lossy(), "other-command");
171171
}
@@ -174,31 +174,31 @@ mod tests {
174174
fn test_podman_event_is_distrobox() {
175175
let mut attrs = HashMap::new();
176176
attrs.insert("manager".to_string(), "distrobox".to_string());
177-
177+
178178
let event = PodmanEvent {
179179
id: Some("abc123".to_string()),
180180
name: Some("my-container".to_string()),
181181
status: Some("start".to_string()),
182182
event_type: Some("container".to_string()),
183183
attributes: Some(attrs),
184184
};
185-
185+
186186
assert!(event.is_distrobox());
187187
}
188188

189189
#[test]
190190
fn test_podman_event_not_distrobox() {
191191
let mut attrs = HashMap::new();
192192
attrs.insert("manager".to_string(), "other".to_string());
193-
193+
194194
let event = PodmanEvent {
195195
id: Some("abc123".to_string()),
196196
name: None,
197197
status: None,
198198
event_type: None,
199199
attributes: Some(attrs),
200200
};
201-
201+
202202
assert!(!event.is_distrobox());
203203
}
204204

@@ -211,7 +211,7 @@ mod tests {
211211
event_type: None,
212212
attributes: None,
213213
};
214-
214+
215215
assert!(!event.is_distrobox());
216216
}
217217

@@ -224,7 +224,7 @@ mod tests {
224224
event_type: Some("container".to_string()),
225225
attributes: None,
226226
};
227-
227+
228228
assert!(event.is_container_event());
229229
}
230230

@@ -237,7 +237,7 @@ mod tests {
237237
event_type: Some("image".to_string()),
238238
attributes: None,
239239
};
240-
240+
241241
assert!(!event.is_container_event());
242242
}
243243

@@ -250,8 +250,7 @@ mod tests {
250250
event_type: None,
251251
attributes: None,
252252
};
253-
253+
254254
assert!(!event.is_container_event());
255255
}
256256
}
257-

src/backends/supported_terminals.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,8 @@ mod imp {
128128
impl ObjectImpl for TerminalRepository {
129129
fn signals() -> &'static [glib::subclass::Signal] {
130130
static SIGNALS: OnceLock<Vec<glib::subclass::Signal>> = OnceLock::new();
131-
SIGNALS.get_or_init(|| {
132-
vec![glib::subclass::Signal::builder("terminals-changed").build()]
133-
})
131+
SIGNALS
132+
.get_or_init(|| vec![glib::subclass::Signal::builder("terminals-changed").build()])
134133
}
135134
}
136135

@@ -169,18 +168,17 @@ impl TerminalRepository {
169168

170169
// Set up the flatpak terminals query fetcher
171170
let runner = command_runner.clone();
172-
this.imp()
173-
.flatpak_terminals_query
174-
.set_fetcher(move || {
175-
let runner = runner.clone();
176-
async move { Self::fetch_flatpak_terminals(&runner).await }
177-
});
171+
this.imp().flatpak_terminals_query.set_fetcher(move || {
172+
let runner = runner.clone();
173+
async move { Self::fetch_flatpak_terminals(&runner).await }
174+
});
178175

179176
// Connect to query success to update the terminal list
180177
let this_clone = this.clone();
181-
this.flatpak_terminals_query().connect_success(move |terminals| {
182-
this_clone.merge_flatpak_terminals(terminals.clone());
183-
});
178+
this.flatpak_terminals_query()
179+
.connect_success(move |terminals| {
180+
this_clone.merge_flatpak_terminals(terminals.clone());
181+
});
184182

185183
this
186184
}
@@ -307,7 +305,8 @@ impl TerminalRepository {
307305
if let Err(e) = std::fs::write(&self.imp().custom_list_path, json) {
308306
error!(
309307
"Failed to write custom terminals to {:?}: {}",
310-
&self.imp().custom_list_path, e
308+
&self.imp().custom_list_path,
309+
e
311310
);
312311
}
313312
}

src/dialogs/command_log_dialog.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,8 @@ impl CommandLogDialog {
190190
if let Some(display) = gdk::Display::default() {
191191
let clipboard = display.clipboard();
192192
clipboard.set_text(&command_owned);
193-
toast_overlay.add_toast(adw::Toast::new(&gettext("Command copied to clipboard")));
193+
toast_overlay
194+
.add_toast(adw::Toast::new(&gettext("Command copied to clipboard")));
194195
}
195196
}
196197
));

src/dialogs/create_distrobox_dialog.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,8 @@ mod imp {
167167
obj.set_home_folder(Some(path.display().to_string()));
168168
},
169169
);
170-
self.home_row_expander.set_title(&gettext("Custom Home Directory"));
170+
self.home_row_expander
171+
.set_title(&gettext("Custom Home Directory"));
171172
self.home_row_expander.set_show_enable_switch(true);
172173
self.home_row_expander.set_enable_expansion(false);
173174
self.home_row_expander.add_row(&home_row);
@@ -237,7 +238,8 @@ mod imp {
237238

238239
let assemble_group = adw::PreferencesGroup::new();
239240
assemble_group.set_title(&gettext("Assemble from File"));
240-
assemble_group.set_description(Some(&gettext("Create a container from an assemble file")));
241+
assemble_group
242+
.set_description(Some(&gettext("Create a container from an assemble file")));
241243

242244
let obj = self.obj().clone();
243245
let file_row = self.obj().build_file_row(
@@ -712,11 +714,13 @@ impl CreateDistroboxDialog {
712714
pub fn build_volumes_group(&self) -> adw::PreferencesGroup {
713715
let volumes_group = adw::PreferencesGroup::new();
714716
volumes_group.set_title(&gettext("Volumes"));
715-
volumes_group.set_description(Some(
716-
&gettext("Specify volumes in the format 'host_path:container_path'"),
717-
));
717+
volumes_group.set_description(Some(&gettext(
718+
"Specify volumes in the format 'host_path:container_path'",
719+
)));
718720

719-
let add_volume_button = adw::ButtonRow::builder().title(&gettext("Add Volume")).build();
721+
let add_volume_button = adw::ButtonRow::builder()
722+
.title(&gettext("Add Volume"))
723+
.build();
720724
add_volume_button.connect_activated(clone!(
721725
#[weak(rename_to=this)]
722726
self,

src/dialogs/exportable_apps_dialog.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,15 @@ mod imp {
7373
self.export_apps_group.set_margin_end(12);
7474
self.export_apps_group.set_margin_top(12);
7575
self.export_apps_group.set_margin_bottom(12);
76-
self.export_apps_group.set_title(&gettext("Exportable Apps"));
76+
self.export_apps_group
77+
.set_title(&gettext("Exportable Apps"));
7778
self.export_apps_group
7879
.set_description(Some(&gettext("No exportable apps found")));
7980
self.export_apps_group.add(&self.list_box);
8081

8182
// Setup binary export input
82-
self.binary_name_entry.set_title(&gettext("Export New Binary"));
83+
self.binary_name_entry
84+
.set_title(&gettext("Export New Binary"));
8385
self.binary_name_entry.set_show_apply_button(true);
8486
self.binary_name_entry.add_css_class("add-binary-entry-row");
8587

@@ -92,7 +94,8 @@ mod imp {
9294
self.export_binaries_group.set_margin_end(12);
9395
self.export_binaries_group.set_margin_top(0);
9496
self.export_binaries_group.set_margin_bottom(12);
95-
self.export_binaries_group.set_title(&gettext("Exported Binaries"));
97+
self.export_binaries_group
98+
.set_title(&gettext("Exported Binaries"));
9699
self.export_binaries_group
97100
.set_description(Some(&gettext("No exported binaries")));
98101
self.export_binaries_group.add(&self.binary_name_entry);

0 commit comments

Comments
 (0)