From 9efb1053badbbcc8e06eaed833cadb79e51cfdd9 Mon Sep 17 00:00:00 2001 From: Tamme Dittrich Date: Fri, 1 Nov 2024 10:41:50 +0100 Subject: [PATCH] Fix clippy warnings --- backend/src/bin/read-driver-db.rs | 7 ++----- backend/src/description.rs | 2 +- backend/src/driver_db/categories.rs | 12 +++--------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/backend/src/bin/read-driver-db.rs b/backend/src/bin/read-driver-db.rs index 5a01986..a00b18e 100644 --- a/backend/src/bin/read-driver-db.rs +++ b/backend/src/bin/read-driver-db.rs @@ -125,11 +125,8 @@ fn read_all(dir: &Path) -> anyhow::Result> { } pub fn parse_crate(path: &Path) -> anyhow::Result<(String, Driver)> { - if !path - .extension() - .is_some_and(|ext| ext == OsStr::new("toml")) - { - bail!("Driver info has wrong exctension: {path:?}"); + if path.extension().is_none_or(|ext| ext != OsStr::new("toml")) { + bail!("Driver info has wrong extension: {path:?}"); } let Some(crate_name) = path.file_stem() else { diff --git a/backend/src/description.rs b/backend/src/description.rs index f3541a0..34bc599 100644 --- a/backend/src/description.rs +++ b/backend/src/description.rs @@ -34,7 +34,7 @@ mod spdx_expression_serde { } struct ExpressionVisitor; - impl<'de> serde::de::Visitor<'de> for ExpressionVisitor { + impl serde::de::Visitor<'_> for ExpressionVisitor { type Value = Expression; fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/backend/src/driver_db/categories.rs b/backend/src/driver_db/categories.rs index 6349cb0..a8536e8 100644 --- a/backend/src/driver_db/categories.rs +++ b/backend/src/driver_db/categories.rs @@ -1,12 +1,6 @@ -use std::{ - borrow::Cow, - collections::BTreeMap, - fmt::{Debug, Display}, - str::FromStr, -}; - -use anyhow::bail; -use schemars::{json_schema, JsonSchema}; +use std::fmt::Debug; + +use schemars::JsonSchema; use serde::{Deserialize, Serialize}; #[derive(