M lib-poki-launcher/src/db.rs => lib-poki-launcher/src/db.rs +2 -2
@@ 92,7 92,7 @@ impl AppsDB {
let mut app_list = match search {
Some(search) => iter
.filter_map(|app| {
- match matcher.fuzzy_match(&app.name, &search) {
+ match matcher.fuzzy_match(&app.name, search) {
Some(score) if score > 0 => {
let mut app = app.clone();
app.score =
@@ 250,7 250,7 @@ impl AppsDB {
/// * Apps in `self` that are not in `apps_to_merge` will be removed from `self`
/// * Apps in `apps_to_merge` not in `self` will be added to `self`
pub fn merge_new_entries(&mut self, mut apps_to_merge: Vec<App>) {
- let apps = std::mem::replace(&mut self.apps, Vec::new());
+ let apps = std::mem::take(&mut self.apps);
self.apps = apps
.into_iter()
.filter(|app| apps_to_merge.contains(app))
M lib-poki-launcher/src/desktop_entry.rs => lib-poki-launcher/src/desktop_entry.rs +26 -28
@@ 125,38 125,36 @@ fn parse_exec(s: &str, name: &str, icon: &str, file_path: &str) -> Vec<String> {
} else {
part.push(c);
}
- } else {
- if c == '"' {
- in_quote = true;
- } else if c == ' ' {
- push(&mut output, part);
- part = String::new();
- } else if c == '%' {
- match iter.next() {
- Some('%') => part.push('%'),
- Some('i') => {
- if !icon.is_empty() {
- push(&mut output, part);
- output.push("--icon".to_owned());
- output.push(icon.to_owned());
- part = String::new();
- }
- }
- Some('c') => {
- push(&mut output, part);
- output.push(name.to_owned());
- part = String::new();
- }
- Some('k') => {
+ } else if c == '"' {
+ in_quote = true;
+ } else if c == ' ' {
+ push(&mut output, part);
+ part = String::new();
+ } else if c == '%' {
+ match iter.next() {
+ Some('%') => part.push('%'),
+ Some('i') => {
+ if !icon.is_empty() {
push(&mut output, part);
- output.push(file_path.to_owned());
+ output.push("--icon".to_owned());
+ output.push(icon.to_owned());
part = String::new();
}
- Some(_) | None => {}
}
- } else {
- part.push(c);
+ Some('c') => {
+ push(&mut output, part);
+ output.push(name.to_owned());
+ part = String::new();
+ }
+ Some('k') => {
+ push(&mut output, part);
+ output.push(file_path.to_owned());
+ part = String::new();
+ }
+ Some(_) | None => {}
}
+ } else {
+ part.push(c);
}
}
push(&mut output, part);
@@ 249,7 247,7 @@ pub fn parse_desktop_file(
}
};
Ok(Some(App::new(
- name.to_owned(),
+ name,
icon.to_owned(),
exec,
terminal,
M lib-poki-launcher/src/scan.rs => lib-poki-launcher/src/scan.rs +1 -1
@@ 67,7 67,7 @@ pub fn desktop_entires(paths: &[PathBuf]) -> (Vec<PathBuf>, Vec<ScanError>) {
/// Get a list of apps for a list of paths to search.
pub fn scan_desktop_entries(paths: &[PathBuf]) -> (Vec<App>, Vec<ScanError>) {
- let (entries, mut errors) = desktop_entires(&paths);
+ let (entries, mut errors) = desktop_entires(paths);
let (apps, errs): (Vec<_>, Vec<_>) = entries
.into_iter()
.map(|path| {