Clippy clean, and rustfmt and clippy part of the checks

cargo clippy --workspace --all-targets had 24 warnings; its own fixes took
most, the rest by hand: two type aliases for long types, a struct built
whole, a checked division, a doc comment's stray blank line. Its fix for
the stale-feed fold was wrong: `any` stops at the first feed it removes,
where the fold removed every one, so that is a loop instead.

A pre-commit hook in .githooks refuses unformatted Rust; clippy, being a
build, is in CLAUDE.md's checks with -D warnings.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-17 21:59:37 +00:00
parent 692a510217
commit c90a66a24f
10 changed files with 89 additions and 57 deletions

View File

@@ -771,7 +771,6 @@ impl Db {
/// Returns true when this enclosure URL is new. False means we have downloaded it
/// before, or deliberately reaped it -- either way it is not fetched again.
pub async fn mark_downloaded(&self, url: &str, path: &std::path::Path, bytes: u64) -> Result<()> {
self.exec(
"UPDATE enclosures SET state = 'done', path = $2, bytes_done = $3,
@@ -1789,7 +1788,7 @@ impl Db {
/// False when they do not subscribe to it, as `set_pinned`.
pub async fn set_kept(&self, user_id: i64, feed_id: &str, on: bool) -> Result<bool> {
let r = subscriptions::Entity::update_many()
.col_expr(subscriptions::Column::Kept, Expr::val(on).into())
.col_expr(subscriptions::Column::Kept, Expr::val(on))
.filter(subscriptions::Column::UserId.eq(user_id))
.filter(subscriptions::Column::FeedId.eq(feed_id))
.exec(&self.orm)
@@ -1819,7 +1818,7 @@ impl Db {
pub async fn set_pinned(&self, user_id: i64, feed_id: &str, on: bool) -> Result<bool> {
let r = subscriptions::Entity::update_many()
.col_expr(subscriptions::Column::Pinned, Expr::val(on).into())
.col_expr(subscriptions::Column::Pinned, Expr::val(on))
.filter(subscriptions::Column::UserId.eq(user_id))
.filter(subscriptions::Column::FeedId.eq(feed_id))
.exec(&self.orm)
@@ -1927,7 +1926,7 @@ impl Db {
use sea_orm::sea_query::ExprTrait;
let now = now();
users::Entity::update_many()
.col_expr(users::Column::LastLogin, Expr::val(now).into())
.col_expr(users::Column::LastLogin, Expr::val(now))
.filter(users::Column::Id.eq(id))
.filter(Expr::expr(Func::coalesce([Expr::col(users::Column::LastLogin), Expr::val(0)])).lte(now - 3600))
.exec(&self.orm)
@@ -1978,7 +1977,7 @@ impl Db {
.and_then(|(_, u)| u);
if found.is_some() {
sessions::Entity::update_many()
.col_expr(sessions::Column::Seen, Expr::val(now()).into())
.col_expr(sessions::Column::Seen, Expr::val(now()))
.filter(sessions::Column::Token.eq(token))
.exec(&self.orm)
.await?;
@@ -2035,7 +2034,7 @@ impl Db {
.await?;
let Some((token, Some(user))) = found else { return Ok(None) };
api_tokens::Entity::update_many()
.col_expr(api_tokens::Column::LastUsed, Expr::val(now()).into())
.col_expr(api_tokens::Column::LastUsed, Expr::val(now()))
.filter(api_tokens::Column::Id.eq(token.id))
.exec(&self.orm)
.await?;
@@ -2711,7 +2710,7 @@ impl Db {
}
if name.is_some() || words.is_some() || description.is_some() {
signal_verdicts::Entity::update_many()
.col_expr(signal_verdicts::Column::Recheck, Expr::val(true).into())
.col_expr(signal_verdicts::Column::Recheck, Expr::val(true))
.filter(signal_verdicts::Column::SignalId.eq(id))
.filter(signal_verdicts::Column::Hit.eq(true))
.exec(&self.orm)