Files
atuin-mirror/clippy.toml
taylor.fish 71a2a7a628 chore: fix Clippy warning about time::Duration (#4231)
`cargo clippy` currently generates this warning:

```
warning: `time::Duration::new` does not refer to a reachable function
 --> /home/taylor/code/atuin/clippy.toml:6:1
  |
6 | / [[disallowed-methods]]
7 | | path = "time::Duration::new"
8 | | reason = "panics on overflow; use atuin_common::time::DurationExt::try_new"
  | |___________________________________________________________________________^
  |
```

`time` 0.3.54 made `Duration` an alias of `SignedDuration` instead of a
struct in its own right, and we're on 0.3.55 now. Clippy can't resolve
the type alias, so this PR updates the path in clippy.toml to point to
`SignedDuration`.
2026-09-22 15:23:44 -07:00

65 lines
2.0 KiB
TOML

[[disallowed-methods]]
path = "std::time::Duration::new"
reason = """panics on overflow; use atuin_common::time::DurationExt::try_new, or \
Duration::from_secs when nanos are 0"""
[[disallowed-methods]]
path = "time::SignedDuration::new"
reason = "panics on overflow; use atuin_common::time::DurationExt::try_new"
[[disallowed-methods]]
path = "std::time::Duration::from_secs_f64"
reason = "panics on NaN/negative/overflow; use Duration::try_from_secs_f64"
[[disallowed-types]]
path = "std::sync::Mutex"
reason = "use parking_lot::Mutex which is faster"
[[disallowed-types]]
path = "std::sync::MutexGuard"
reason = "use parking_lot::MutexGuard which is faster"
[[disallowed-types]]
path = "std::sync::RwLock"
reason = "use parking_lot::RwLock which is faster"
[[disallowed-types]]
path = "std::sync::RwLockReadGuard"
reason = "use parking_lot::RwLockReadGuard which is faster"
[[disallowed-types]]
path = "std::sync::RwLockWriteGuard"
reason = "use parking_lot::RwLockWriteGuard which is faster"
[[disallowed-types]]
path = "std::sync::Condvar"
reason = "use parking_lot::Condvar which is faster"
[[disallowed-types]]
path = "std::sync::Once"
reason = "use parking_lot::Once which is faster"
[[disallowed-types]]
path = "std::sync::ReentrantLock"
reason = "use parking_lot::ReentrantMutex which is faster"
[[disallowed-methods]]
path = "sqlx::query"
reason = """use atuin_common::db::query, which forwards to sqlx::query and, in debug builds, \
rejects `SELECT *` and `ALTER` (a cached `SELECT *` whose column count changes under an \
ALTER panics in sqlx-sqlite)"""
[[disallowed-methods]]
path = "sqlx::query_as"
reason = "use atuin_common::db::query_as; see the note on sqlx::query"
[[disallowed-methods]]
path = "sqlx::query_scalar"
reason = "use atuin_common::db::query_scalar; see the note on sqlx::query"
[[disallowed-macros]]
path = "sqlx::migrate"
reason = """use atuin_common::db::migrate!, which runs the migrator and then clears the \
connection's prepared-statement cache so a later query can't reuse pre-migration column \
metadata"""