mirror of
https://github.com/pcvolkmer/osc-variant.git
synced 2025-07-02 08:42:54 +00:00
chore: add linter config and related code cleanup
This commit is contained in:
12
Cargo.toml
12
Cargo.toml
@ -42,6 +42,18 @@ lto = "thin"
|
|||||||
strip = true
|
strip = true
|
||||||
panic = "abort"
|
panic = "abort"
|
||||||
|
|
||||||
|
# Lints
|
||||||
|
|
||||||
|
[lints.clippy]
|
||||||
|
unwrap_used = "deny"
|
||||||
|
expect_used = "deny"
|
||||||
|
panic = "deny"
|
||||||
|
|
||||||
|
[lints.rust]
|
||||||
|
unused_must_use = "deny"
|
||||||
|
|
||||||
|
# Packaging
|
||||||
|
|
||||||
[package.metadata.deb]
|
[package.metadata.deb]
|
||||||
copyright = "Copyright (C) 2023-2024 the original author or authors"
|
copyright = "Copyright (C) 2023-2024 the original author or authors"
|
||||||
extended-description = "Anwendung zum Anpassen einer OSC-Datei an einen Standort."
|
extended-description = "Anwendung zum Anpassen einer OSC-Datei an einen Standort."
|
||||||
|
@ -178,25 +178,33 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
let mut strip = strip;
|
let mut strip = strip;
|
||||||
|
|
||||||
if interactive {
|
if interactive {
|
||||||
compact = Confirm::new()
|
compact = matches!(
|
||||||
.with_prompt("Kompakte Ausgabe, ohne Einrücken?")
|
Confirm::new()
|
||||||
.default(compact)
|
.with_prompt("Kompakte Ausgabe, ohne Einrücken?")
|
||||||
.interact()
|
.default(compact)
|
||||||
.unwrap();
|
.interact(),
|
||||||
|
Ok(true)
|
||||||
|
);
|
||||||
|
|
||||||
sorted = Confirm::new()
|
sorted = matches!(
|
||||||
.with_prompt("Sortiere Kataloge und Formulare nach Name und Abhängigkeiten?")
|
Confirm::new()
|
||||||
.default(sorted)
|
.with_prompt(
|
||||||
.interact()
|
"Sortiere Kataloge und Formulare nach Name und Abhängigkeiten?"
|
||||||
.unwrap();
|
)
|
||||||
|
.default(sorted)
|
||||||
|
.interact(),
|
||||||
|
Ok(true)
|
||||||
|
);
|
||||||
|
|
||||||
strip = Confirm::new()
|
strip = matches!(
|
||||||
.with_prompt(
|
Confirm::new()
|
||||||
"Entferne Einträge aus der Systembibliothek die nicht importiert werden?",
|
.with_prompt(
|
||||||
)
|
"Entferne Einträge aus der Systembibliothek die nicht importiert werden?",
|
||||||
.default(strip)
|
)
|
||||||
.interact()
|
.default(strip)
|
||||||
.unwrap();
|
.interact(),
|
||||||
|
Ok(true)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if fix {
|
if fix {
|
||||||
@ -218,7 +226,9 @@ pub fn handle(command: SubCommand) -> Result<(), Box<dyn Error>> {
|
|||||||
serializer.indent(' ', 2);
|
serializer.indent(' ', 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
data.serialize(serializer).expect("Generated XML");
|
data.serialize(serializer).map_err(|_| {
|
||||||
|
FileError::Writing("Cannot serialize result".to_string(), String::new())
|
||||||
|
})?;
|
||||||
|
|
||||||
let output = &"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
let output = &"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
|
||||||
.to_string()
|
.to_string()
|
||||||
|
@ -123,8 +123,7 @@ where
|
|||||||
}
|
}
|
||||||
_ => None,
|
_ => None,
|
||||||
})
|
})
|
||||||
.filter(Option::is_some)
|
.filter_map(|item| item.map(|item| format!(" - {item}\n")))
|
||||||
.map(|item| format!(" - {}\n", item.unwrap()))
|
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
.join("");
|
.join("");
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user