fix some pedantic lints

This commit is contained in:
Dr. Matthias Ratajczak
2023-01-10 15:25:54 +01:00
parent 5e874d79d4
commit 9f649aae2e
4 changed files with 8 additions and 6 deletions
+2 -1
View File
@@ -25,6 +25,7 @@ fn get_arg_parser() -> Command<'static> {
result result
} }
pub fn get_args() -> clap::ArgMatches { #[must_use]
pub fn get() -> clap::ArgMatches {
get_arg_parser().get_matches() get_arg_parser().get_matches()
} }
+4 -3
View File
@@ -15,6 +15,7 @@ pub struct Pacdef {
} }
impl Pacdef { impl Pacdef {
#[must_use]
pub fn new(args: ArgMatches, groups: HashSet<Group>) -> Self { pub fn new(args: ArgMatches, groups: HashSet<Group>) -> Self {
Self { args, groups } Self { args, groups }
} }
@@ -62,7 +63,7 @@ impl Pacdef {
return; return;
}; };
to_install.install_missing_packages() to_install.install_missing_packages();
} }
fn edit_group_files(&self, groups: &ArgMatches) -> Result<()> { fn edit_group_files(&self, groups: &ArgMatches) -> Result<()> {
@@ -95,7 +96,7 @@ impl Pacdef {
} }
fn show_version(self) { fn show_version(self) {
println!("pacdef, version: {}", env!("CARGO_PKG_VERSION")) println!("pacdef, version: {}", env!("CARGO_PKG_VERSION"));
} }
fn show_unmanaged_packages(self) { fn show_unmanaged_packages(self) {
@@ -147,7 +148,7 @@ impl Pacdef {
println!(" {}", backend.get_section()); println!(" {}", backend.get_section());
for package in packages { for package in packages {
println!(" {}", package); println!(" {package}");
} }
} }
+1 -1
View File
@@ -23,7 +23,7 @@ impl Group {
let path = file.path(); let path = file.path();
let group = let group =
Group::try_from(&path).with_context(|| format!("reading group file {:?}", path))?; Group::try_from(&path).with_context(|| format!("reading group file {path:?}"))?;
result.insert(group); result.insert(group);
} }
+1 -1
View File
@@ -3,7 +3,7 @@ use anyhow::{Context, Result};
use pacdef::{args, Group, Pacdef}; use pacdef::{args, Group, Pacdef};
fn main() -> Result<()> { fn main() -> Result<()> {
let args = args::get_args(); let args = args::get();
let groups = Group::load_from_dir()?; let groups = Group::load_from_dir()?;
let pacdef = Pacdef::new(args, groups); let pacdef = Pacdef::new(args, groups);
pacdef.run_action_from_arg().context("running action") pacdef.run_action_from_arg().context("running action")