diff --git a/crates/rattler_lock/src/parse/deserialize.rs b/crates/rattler_lock/src/parse/deserialize.rs index 1c6eb47b6..1a74c415a 100644 --- a/crates/rattler_lock/src/parse/deserialize.rs +++ b/crates/rattler_lock/src/parse/deserialize.rs @@ -280,27 +280,20 @@ fn parse_from_lock
(
.iter()
.find(|&idx| {
let conda_package = &conda_packages[*idx];
- name.as_ref().map_or(true, |name| {
+ name.as_ref().is_none_or(|name| {
name == &conda_package.record().name
- }) && version.as_ref().map_or(
- true,
+ }) && version.as_ref().is_none_or(
|version| {
version
== &conda_package
.record()
.version
},
- ) && build.as_ref().map_or(true, |build| {
+ ) && build.as_ref().is_none_or(|build| {
build == &conda_package.record().build
- }) && subdir.as_ref().map_or(
- true,
- |subdir| {
- subdir
- == &conda_package
- .record()
- .subdir
- },
- )
+ }) && subdir.as_ref().is_none_or(|subdir| {
+ subdir == &conda_package.record().subdir
+ })
})
.copied()
};
diff --git a/crates/rattler_menuinst/src/linux.rs b/crates/rattler_menuinst/src/linux.rs
index 73bbb9658..eae763045 100644
--- a/crates/rattler_menuinst/src/linux.rs
+++ b/crates/rattler_menuinst/src/linux.rs
@@ -569,20 +569,17 @@ impl LinuxMenu {
let file_path = temp_dir.path().join(file_name);
fs::write(&file_path, &xml)?;
- match xdg_mime(&file_path, self.mode, XdgMimeOperation::Install) {
- Ok(_) => {
- // keep temp dir in prefix around and the temp file
- // because we re-use it when unregistering the mime type.
- let _ = temp_dir.into_path();
- tracker.registered_mime_files.push(file_path);
- }
- Err(_) => {
- if let Some(parent) = xml_path.parent() {
- fs::create_dir_all(parent)?;
- }
- fs::write(&xml_path, xml)?;
- tracker.paths.push(xml_path);
+ if xdg_mime(&file_path, self.mode, XdgMimeOperation::Install).is_ok() {
+ // keep temp dir in prefix around and the temp file
+ // because we re-use it when unregistering the mime type.
+ let _ = temp_dir.into_path();
+ tracker.registered_mime_files.push(file_path);
+ } else {
+ if let Some(parent) = xml_path.parent() {
+ fs::create_dir_all(parent)?;
}
+ fs::write(&xml_path, xml)?;
+ tracker.paths.push(xml_path);
}
Ok(())
@@ -746,7 +743,7 @@ mod tests {
for item in &parsed_schema.menu_items {
let icon = item.command.icon.as_ref().unwrap();
for ext in &["icns", "png", "svg"] {
- placeholders.insert("ICON_EXT".to_string(), ext.to_string());
+ placeholders.insert("ICON_EXT".to_string(), (*ext).to_string());
let icon_path = icon.resolve(FakePlaceholders {
placeholders: placeholders.clone(),
});
diff --git a/crates/rattler_menuinst/src/linux/mime_config.rs b/crates/rattler_menuinst/src/linux/mime_config.rs
index 6fd6fd6e8..b40ba3609 100644
--- a/crates/rattler_menuinst/src/linux/mime_config.rs
+++ b/crates/rattler_menuinst/src/linux/mime_config.rs
@@ -22,7 +22,7 @@ impl MimeConfig {
}
}
- /// Create a new MimeConfig instance and load the configuration from the given path
+ /// Create a new `MimeConfig` instance and load the configuration from the given path
pub fn load