Skip to content

Commit

Permalink
Make pedantic lints default and fix them
Browse files Browse the repository at this point in the history
... except for the const unwraps.
  • Loading branch information
matze committed Jan 15, 2025
1 parent daa1786 commit 2f3784e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
components: clippy
- name: Run cargo-deny
uses: EmbarkStudios/cargo-deny-action@v2
- run: cargo clippy -- -W clippy::pedantic
- run: cargo clippy
- run: cargo fmt --all --check
- run: cargo test --all-targets
- run: WASTEBIN_BASE_URL="http://127.0.0.1:8080/wastebin" cargo test # port is not relevant
Expand Down
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ if_not_else = "deny"
items_after_statements = "deny"
mut_mut = "deny"
panic = "deny"
pedantic = "deny"
print_stdout = "deny"
similar_names = "deny"
unicode_not_nfc = "deny"
Expand Down
1 change: 1 addition & 0 deletions src/pages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ impl std::fmt::Display for Expiration {
}
}

#[allow(clippy::unwrap_used)]
const EXPIRATION_OPTIONS: [(&str, Expiration); 8] = [
("never", Expiration::None),
("10 minutes", Expiration::Time(NonZero::new(600).unwrap())),
Expand Down
4 changes: 2 additions & 2 deletions src/routes/paste.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ async fn get_html(
.transpose()
.map_err(|err| Error::CookieParsing(err.to_string()))?
.zip(entry.uid)
.map_or(false, |(user_uid, owner_uid)| user_uid == owner_uid);
.is_some_and(|(user_uid, owner_uid)| user_uid == owner_uid);

if let Some(html) = state.cache.get(&key) {
tracing::trace!(?key, "found cached item");
Expand Down Expand Up @@ -263,7 +263,7 @@ pub async fn delete(
.transpose()
.map_err(|err| Error::CookieParsing(err.to_string()))?
.zip(uid)
.map_or(false, |(user_uid, db_uid)| user_uid == db_uid);
.is_some_and(|(user_uid, db_uid)| user_uid == db_uid);

if !can_delete {
Err(Error::Delete)?;
Expand Down

0 comments on commit 2f3784e

Please sign in to comment.