Compare commits

..

1 Commits

Author SHA1 Message Date
2e773cdeaf style: format code for better readability in tests and function signatures
Some checks failed
CI / test (push) Failing after 4m59s
CI / clippy (push) Failing after 4m58s
CI / fmt (push) Successful in 23s
2026-03-18 13:59:53 +01:00
4 changed files with 23 additions and 18 deletions

View File

@@ -167,10 +167,7 @@ mod tests {
#[test]
fn split_quoted_path() {
assert_eq!(
shell_split(r#""My App" --flag"#),
vec!["My App", "--flag"]
);
assert_eq!(shell_split(r#""My App" --flag"#), vec!["My App", "--flag"]);
}
#[test]

View File

@@ -105,15 +105,14 @@ impl Plugin for ExternalPlugin {
}
let result = match guard.as_mut() {
Some(io) => tokio::time::timeout(
std::time::Duration::from_secs(5),
do_search(io, query),
)
.await
.unwrap_or_else(|_| {
tracing::warn!("plugin {} search timed out", self.name);
Err("timeout".into())
}),
Some(io) => {
tokio::time::timeout(std::time::Duration::from_secs(5), do_search(io, query))
.await
.unwrap_or_else(|_| {
tracing::warn!("plugin {} search timed out", self.name);
Err("timeout".into())
})
}
None => unreachable!(),
};

View File

@@ -57,7 +57,10 @@ impl FrecencyStore {
.as_secs();
let json = {
let mut data = self.data.lock().unwrap();
let entry = data.entry(id.to_string()).or_insert(Entry { count: 0, last_used: 0 });
let entry = data.entry(id.to_string()).or_insert(Entry {
count: 0,
last_used: 0,
});
entry.count += 1;
entry.last_used = now;
serde_json::to_string(&*data).ok()

View File

@@ -135,7 +135,10 @@ fn save_to_path(path: &Path, entries: &HashMap<String, CachedEntry>) {
}
}
fn build_entries(source: &impl DesktopEntrySource, _frecency: &Arc<FrecencyStore>) -> HashMap<String, CachedEntry> {
fn build_entries(
source: &impl DesktopEntrySource,
_frecency: &Arc<FrecencyStore>,
) -> HashMap<String, CachedEntry> {
source
.entries()
.into_iter()
@@ -209,7 +212,10 @@ impl AppsPlugin {
}
#[cfg(test)]
fn new_for_test(source: impl DesktopEntrySource + 'static, frecency: Arc<FrecencyStore>) -> Self {
fn new_for_test(
source: impl DesktopEntrySource + 'static,
frecency: Arc<FrecencyStore>,
) -> Self {
Self::new_impl(source, frecency, None)
}
}
@@ -498,8 +504,8 @@ mod tests {
#[test]
fn apps_loads_from_cache_when_source_is_empty() {
let frecency = ephemeral_frecency();
let cache_file = std::env::temp_dir()
.join(format!("k-launcher-test-{}.bin", std::process::id()));
let cache_file =
std::env::temp_dir().join(format!("k-launcher-test-{}.bin", std::process::id()));
// Build entries from a real source and save to temp path
let source = MockSource::with(vec![("Firefox", "firefox")]);