Skip to content

Commit

Permalink
Various clippy fixes
Browse files Browse the repository at this point in the history
Also use `nightly` for local clippy tests
  • Loading branch information
LDeakin committed Jan 2, 2024
1 parent 45ac10c commit 492f808
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ cargo build --all-features && \
cargo test --all-features && \
cargo +nightly doc --all-features && \
cargo fmt --all -- --check && \
cargo clippy --all-features -- -D warnings && \
cargo +nightly clippy --all-features -- -D warnings && \
cargo check && \
cargo check --no-default-features
```

```bash
# Additional checks
cargo clippy --all-features -- -D warnings -W clippy::nursery -A clippy::significant_drop_tightening -A clippy::significant_drop_in_scrutinee
cargo +nightly clippy --all-features -- -D warnings -W clippy::nursery -A clippy::significant_drop_tightening -A clippy::significant_drop_in_scrutinee
# cargo clippy --all-features -- -D warnings -W clippy::unwrap_used -W clippy::expect_used
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ impl GzipCompressionLevel {
/// Create a new compression level.
///
/// # Errors
///
/// Errors if `compression_level` is not between 0-9.
pub fn new<N: num::Unsigned + std::cmp::PartialOrd<u32>>(
compression_level: N,
Expand All @@ -60,7 +59,7 @@ impl GzipCompressionLevel {
u32: From<N>,
{
if compression_level < 10 {
Ok(Self(u32::try_from(compression_level).unwrap_or_default()))
Ok(Self(u32::from(compression_level)))
} else {
Err(compression_level)
}
Expand Down
4 changes: 2 additions & 2 deletions src/storage/storage_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub trait ReadableStorageTraits: Send + Sync {
///
/// # Errors
///
/// Returns a `StorageError` if the store does not support size() or there is an underlying error with the store.
/// Returns a `StorageError` if the store does not support `size()` or there is an underlying error with the store.
fn size_prefix(&self, prefix: &StorePrefix) -> Result<u64, StorageError>;

/// Return the size in bytes of the value at `key`.
Expand All @@ -73,7 +73,7 @@ pub trait ReadableStorageTraits: Send + Sync {
///
/// # Errors
///
/// Returns a `StorageError` if the store does not support size() or there is an underlying error with the store.
/// Returns a `StorageError` if the store does not support `size()` or there is an underlying error with the store.
fn size(&self) -> Result<u64, StorageError> {
self.size_prefix(&StorePrefix::root())
}
Expand Down

0 comments on commit 492f808

Please sign in to comment.