clippy
This commit is contained in:
@@ -77,8 +77,8 @@ pub enum Error {
|
||||
impl fmt::Display for Error {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match self {
|
||||
Self::Database(error) => write!(f, "{}", error),
|
||||
Self::Query(error) => write!(f, "{}", error),
|
||||
Self::Database(error) => write!(f, "{error}"),
|
||||
Self::Query(error) => write!(f, "{error}"),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -125,23 +125,17 @@ impl From<sqlx::Error> for Error {
|
||||
description: "item with unique constraint already exists".to_string(),
|
||||
}),
|
||||
_ => Error::Database(DatabaseError::Sql {
|
||||
description: format!(
|
||||
"got error with unknown code: {}",
|
||||
sqlite_error
|
||||
),
|
||||
description: format!("got error with unknown code: {sqlite_error}"),
|
||||
}),
|
||||
}
|
||||
} else {
|
||||
Error::Database(DatabaseError::Sql {
|
||||
description: format!(
|
||||
"got error without code: {}",
|
||||
sqlite_error
|
||||
),
|
||||
description: format!("got error without code: {sqlite_error}"),
|
||||
})
|
||||
}
|
||||
}
|
||||
_ => Error::Database(DatabaseError::Sql {
|
||||
description: format!("got unknown error: {}", value),
|
||||
description: format!("got unknown error: {value}"),
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ impl Inventory {
|
||||
.collect::<Result<Vec<Category>, Error>>()?;
|
||||
|
||||
for category in &mut categories {
|
||||
category.populate_items(ctx, pool).await?;
|
||||
category.populate_items(&ctx, &pool).await?;
|
||||
}
|
||||
|
||||
Ok(Self { categories })
|
||||
@@ -384,7 +384,7 @@ impl InventoryItem {
|
||||
.map_ok(|row| {
|
||||
// convert to i64 because that the default integer type, but looks
|
||||
// like COALESCE return i32?
|
||||
row.weight as i64
|
||||
i64::from(row.weight)
|
||||
})
|
||||
.await?;
|
||||
|
||||
@@ -451,7 +451,7 @@ impl Item {
|
||||
.map_ok(|row| {
|
||||
// convert to i64 because that the default integer type, but looks
|
||||
// like COALESCE return i32?
|
||||
row.weight as i64
|
||||
i64::from(row.weight)
|
||||
})
|
||||
.await?)
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ impl TripCategory {
|
||||
items: None,
|
||||
},
|
||||
items: None,
|
||||
})
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@@ -245,6 +245,7 @@ impl TripCategory {
|
||||
}
|
||||
}
|
||||
|
||||
// TODO refactor the bools into an enum
|
||||
#[derive(Debug)]
|
||||
pub struct TripItem {
|
||||
pub item: inventory::Item,
|
||||
@@ -673,7 +674,7 @@ impl Trip {
|
||||
user_id,
|
||||
)
|
||||
.fetch_one(pool)
|
||||
.map_ok(|row| row.total_weight.unwrap() as i64)
|
||||
.map_ok(|row| i64::from(row.total_weight.unwrap()))
|
||||
.await?;
|
||||
|
||||
Ok(weight)
|
||||
|
||||
Reference in New Issue
Block a user