Skip to content

Commit b10401b

Browse files
committed
apply clippy suggestions
1 parent e92174b commit b10401b

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/main.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ fn create_database<P: AsRef<Path>>(
2323

2424
if path.exists() {
2525
if path.is_symlink() || path.is_file() {
26-
fs::remove_file(&path).unwrap();
26+
fs::remove_file(path).unwrap();
2727
} else {
2828
println!("{} exists but is not a file.", path.display());
2929
}
3030
}
3131

32-
File::create(&path).unwrap();
32+
File::create(path).unwrap();
3333

34-
let mut conn = Connection::open(&path).unwrap();
34+
let mut conn = Connection::open(path).unwrap();
3535
let tx = conn.transaction()?;
3636

3737
let sql = include_str!("metadata.sql");
@@ -48,7 +48,7 @@ fn create_database<P: AsRef<Path>>(
4848
let statements = Statements::new(&tx)?;
4949

5050
let mut repo = PackageRepository::new(&tx, statements, repo_name);
51-
repo.import_packages(&packages, "unknown")?;
51+
repo.import_packages(packages, "unknown")?;
5252
}
5353

5454
tx.commit()?;
@@ -57,7 +57,7 @@ fn create_database<P: AsRef<Path>>(
5757
}
5858

5959
fn abort(msg: &str) -> ! {
60-
eprintln!("{}", msg);
60+
eprintln!("{msg}");
6161
let usage = r#"
6262
Soar JSON metadata to SQLite converter
6363
@@ -66,7 +66,7 @@ Options:
6666
--output, -o Output SQLite file
6767
--repo, -r Name of the repository
6868
"#;
69-
eprintln!("{}", usage);
69+
eprintln!("{usage}");
7070
std::process::exit(1);
7171
}
7272

@@ -113,7 +113,7 @@ fn main() -> io::Result<()> {
113113
}
114114
arg => {
115115
if arg.starts_with("-") {
116-
abort(&format!("Unknown argument '{}'", arg));
116+
abort(&format!("Unknown argument '{arg}'"));
117117
}
118118
}
119119
}

src/repository.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'a> PackageRepository<'a> {
8484
|| ["==", "=>", ":"]
8585
.iter()
8686
.find_map(|&delim| p.split_once(delim))
87-
.map_or(false, |(first, _)| first == package.pkg_name);
87+
.is_some_and(|(first, _)| first == package.pkg_name);
8888
matches.then(|| PackageProvide::from_string(&p))
8989
})
9090
.collect::<Vec<PackageProvide>>()
@@ -140,7 +140,7 @@ impl<'a> PackageRepository<'a> {
140140
}
141141
let package_id = self.tx.last_insert_rowid();
142142
for maintainer in &package.maintainers.clone().unwrap_or_default() {
143-
let typed = self.extract_name_and_contact(&maintainer);
143+
let typed = self.extract_name_and_contact(maintainer);
144144
if let Some((name, contact)) = typed {
145145
let maintainer_id = self.get_or_create_maintainer(&name, &contact)?;
146146
self.statements

0 commit comments

Comments
 (0)