Clippy lints
This commit is contained in:
parent
0fe6fe0be1
commit
4a59611311
@ -33,7 +33,7 @@ tempfile = "3.15.0"
|
||||
[features]
|
||||
default = ["database-json", "library-beets"]
|
||||
bin = ["structopt"]
|
||||
database-sqlite = ["rusqlite"]
|
||||
database-sqlite = ["rusqlite", "serde", "serde_json"]
|
||||
database-json = ["serde", "serde_json"]
|
||||
library-beets = []
|
||||
library-beets-ssh = ["openssh", "tokio"]
|
||||
|
@ -36,7 +36,7 @@ impl SqlDatabaseSqliteBackend {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'conn> SqlTransactionSqliteBackend<'conn> {
|
||||
impl SqlTransactionSqliteBackend<'_> {
|
||||
fn prepare(&self, sql: &str) -> Result<Statement, Error> {
|
||||
self.tx
|
||||
.prepare(sql)
|
||||
@ -88,7 +88,7 @@ impl<'conn> ISqlDatabaseBackend<'conn> for SqlDatabaseSqliteBackend {
|
||||
}
|
||||
}
|
||||
|
||||
impl<'conn> ISqlTransactionBackend for SqlTransactionSqliteBackend<'conn> {
|
||||
impl ISqlTransactionBackend for SqlTransactionSqliteBackend<'_> {
|
||||
fn commit(self) -> Result<(), Error> {
|
||||
self.tx
|
||||
.commit()
|
||||
@ -151,7 +151,7 @@ impl<'conn> ISqlTransactionBackend for SqlTransactionSqliteBackend<'conn> {
|
||||
Self::execute(&mut stmt, ())
|
||||
}
|
||||
|
||||
fn insert_database_version<'a>(&self, version: &SerializeDatabase<'a>) -> Result<(), Error> {
|
||||
fn insert_database_version(&self, version: &SerializeDatabase<'_>) -> Result<(), Error> {
|
||||
let mut stmt = self.prepare_cached(
|
||||
"INSERT INTO database_metadata (name, value)
|
||||
VALUES (?1, ?2)",
|
||||
@ -169,10 +169,10 @@ impl<'conn> ISqlTransactionBackend for SqlTransactionSqliteBackend<'conn> {
|
||||
|
||||
match Self::next_row(&mut rows)? {
|
||||
Some(row) => {
|
||||
let version: String = Self::get_value(&row, 0)?;
|
||||
let version: String = Self::get_value(row, 0)?;
|
||||
match version.as_str() {
|
||||
"V20250103" => Ok(DeserializeDatabase::V20250103(vec![])),
|
||||
s @ _ => Err(Error::SerDeError(format!("unknown database version: {s}"))),
|
||||
s => Err(Error::SerDeError(format!("unknown database version: {s}"))),
|
||||
}
|
||||
}
|
||||
None => Err(Error::SerDeError(String::from(
|
||||
@ -181,7 +181,7 @@ impl<'conn> ISqlTransactionBackend for SqlTransactionSqliteBackend<'conn> {
|
||||
}
|
||||
}
|
||||
|
||||
fn insert_artist<'a>(&self, artist: &SerializeArtist<'a>) -> Result<(), Error> {
|
||||
fn insert_artist(&self, artist: &SerializeArtist<'_>) -> Result<(), Error> {
|
||||
let mut stmt = self.prepare_cached(
|
||||
"INSERT INTO artists (name, sort, mbid, properties)
|
||||
VALUES (?1, ?2, ?3, ?4)",
|
||||
@ -215,7 +215,7 @@ impl<'conn> ISqlTransactionBackend for SqlTransactionSqliteBackend<'conn> {
|
||||
Ok(artists)
|
||||
}
|
||||
|
||||
fn insert_album<'a>(&self, artist_name: &str, album: &SerializeAlbum<'a>) -> Result<(), Error> {
|
||||
fn insert_album(&self, artist_name: &str, album: &SerializeAlbum<'_>) -> Result<(), Error> {
|
||||
let mut stmt = self.prepare_cached(
|
||||
"INSERT INTO albums (title, lib_id, mbid, artist_name,
|
||||
year, month, day, seq, primary_type, secondary_types)
|
||||
|
@ -51,18 +51,21 @@ pub trait ISqlTransactionBackend {
|
||||
fn drop_albums_table(&self) -> Result<(), Error>;
|
||||
|
||||
/// Set the database version.
|
||||
#[allow(clippy::needless_lifetimes)] // Conflicts with automock.
|
||||
fn insert_database_version<'a>(&self, version: &SerializeDatabase<'a>) -> Result<(), Error>;
|
||||
|
||||
/// Get the database version.
|
||||
fn select_database_version<'a>(&self) -> Result<DeserializeDatabase, Error>;
|
||||
fn select_database_version(&self) -> Result<DeserializeDatabase, Error>;
|
||||
|
||||
/// Insert an artist into the artist table.
|
||||
#[allow(clippy::needless_lifetimes)] // Conflicts with automock.
|
||||
fn insert_artist<'a>(&self, artist: &SerializeArtist<'a>) -> Result<(), Error>;
|
||||
|
||||
/// Get all artists from the artist table.
|
||||
fn select_all_artists(&self) -> Result<Vec<DeserializeArtist>, Error>;
|
||||
|
||||
/// Insert an artist into the artist table.
|
||||
#[allow(clippy::needless_lifetimes)] // Conflicts with automock.
|
||||
fn insert_album<'a>(&self, artist_name: &str, album: &SerializeAlbum<'a>) -> Result<(), Error>;
|
||||
|
||||
/// Get all albums from the album table.
|
||||
|
Loading…
x
Reference in New Issue
Block a user