⭐
Log in to mark this repository.
Clippy: let-chains for nested ifs, and what the lints found besides
79bf34b · Gabe Morell · 2026-11-05 00:31
Message
{commit_body(@commit)}
Files changed
modified
migration/src/m20241229_000002_create_uploads_table.rs
+0
−6
@@ -6,12 +6,6 @@ pub struct Migration;
| 6 | 6 | #[async_trait::async_trait] |
| 7 | 7 | impl MigrationTrait for Migration { |
| 8 | 8 | async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { |
| 9 | − // Reference to the Users table from the previous migration | |
| 10 | − let users_table = Table::create() | |
| 11 | − .table(Alias::new("users")) | |
| 12 | − .col(ColumnDef::new(Alias::new("id")).big_integer()) | |
| 13 | − .to_owned(); | |
| 14 | − | |
| 15 | 9 | // Create uploads table |
| 16 | 10 | manager |
| 17 | 11 | .create_table( |
modified
src/auth/api_tokens.rs
+4
−4
@@ -44,10 +44,10 @@ pub async fn validate_api_token(
| 44 | 44 | .await |
| 45 | 45 | .context("query api_token")?; |
| 46 | 46 | let Some(row) = row else { return Ok(None); }; |
| 47 | − if let Some(exp) = row.expires_at { | |
| 48 | − if exp < Utc::now() { | |
| 49 | − return Ok(None); | |
| 50 | − } | |
| 47 | + if let Some(exp) = row.expires_at | |
| 48 | + && exp < Utc::now() | |
| 49 | + { | |
| 50 | + return Ok(None); | |
| 51 | 51 | } |
| 52 | 52 | // Bump last_used_at — best effort, don't fail validation on update error. |
| 53 | 53 | let mut update: api_tokens::ActiveModel = row.clone().into(); |
modified
src/auth/tokens.rs
+4
−4
@@ -130,10 +130,10 @@ pub async fn validate_registration_token(
| 130 | 130 | match reg_token { |
| 131 | 131 | Some(token_model) => { |
| 132 | 132 | // If token has a specific email, check it matches |
| 133 | − if let Some(token_email) = &token_model.email { | |
| 134 | − if token_email != email { | |
| 135 | − return Ok(None); | |
| 136 | − } | |
| 133 | + if let Some(token_email) = &token_model.email | |
| 134 | + && token_email != email | |
| 135 | + { | |
| 136 | + return Ok(None); | |
| 137 | 137 | } |
| 138 | 138 | Ok(Some(token_model)) |
| 139 | 139 | } |
modified
src/auth/users.rs
+4
−4
@@ -249,10 +249,10 @@ pub async fn find_user_by_identifier(
| 249 | 249 | db: &DatabaseConnection, |
| 250 | 250 | identifier: &str, |
| 251 | 251 | ) -> Result<Option<users::Model>> { |
| 252 | − if let Ok(id) = Uuid::parse_str(identifier) { | |
| 253 | − if let Some(user) = get_user_by_id(db, id).await? { | |
| 254 | − return Ok(Some(user)); | |
| 255 | − } | |
| 252 | + if let Ok(id) = Uuid::parse_str(identifier) | |
| 253 | + && let Some(user) = get_user_by_id(db, id).await? | |
| 254 | + { | |
| 255 | + return Ok(Some(user)); | |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | users::Entity::find() |
modified
src/bin/queue-worker.rs
+1
−1
@@ -34,7 +34,7 @@ async fn main() -> Result<(), anyhow::Error> {
| 34 | 34 | .init(); |
| 35 | 35 | |
| 36 | 36 | let cli = Cli::parse(); |
| 37 | − let kind = JobKind::from_str(&cli.kind) | |
| 37 | + let kind = JobKind::from_name(&cli.kind) | |
| 38 | 38 | .ok_or_else(|| anyhow::anyhow!("unknown --kind: {}", cli.kind))?; |
| 39 | 39 | |
| 40 | 40 | let config = Arc::new(Config::from_env()?); |
modified
src/handlers/failed.rs
+4
−4
Click to load diff…
modified
src/handlers/uploads.rs
+48
−56
Click to load diff…
modified
src/middleware/auth.rs
+5
−5
Click to load diff…
modified
src/queue/messages.rs
+2
−2
Click to load diff…
modified
src/workers/extract_tags.rs
+1
−1
Click to load diff…
modified
tests/search_integration.rs
+0
−2
Click to load diff…
Parents: e03a73e