Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions .github/workflows/blobby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: blobby

on:
pull_request:
paths:
- "blobby/**"
- "Cargo.*"
paths:
- "blobby/**"
- "Cargo.*"
push:
branches: master

Expand Down Expand Up @@ -38,11 +38,4 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
- run: rm ../Cargo.toml
- run: cargo test

minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}
15 changes: 8 additions & 7 deletions .github/workflows/block-buffer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: block-buffer

on:
pull_request:
paths:
- "block-buffer/**"
- "Cargo.*"
paths:
- "block-buffer/**"
- "Cargo.*"
push:
branches: master

Expand Down Expand Up @@ -44,10 +44,11 @@ jobs:
targets: ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }}

minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
# minimal-versions:
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
# with:
# working-directory: ${{ github.workflow }}

test:
runs-on: ubuntu-latest
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/block-padding.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: block-padding

on:
pull_request:
paths:
- "block-padding/**"
- "Cargo.*"
paths:
- "block-padding/**"
- "Cargo.*"
push:
branches: master

Expand Down Expand Up @@ -44,10 +44,11 @@ jobs:
targets: ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }}

minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
# minimal-versions:
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
# with:
# working-directory: ${{ github.workflow }}

test:
runs-on: ubuntu-latest
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/cmov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ concurrency:
cancel-in-progress: true

jobs:
minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
# minimal-versions:
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
# with:
# working-directory: ${{ github.workflow }}

build:
runs-on: ubuntu-latest
Expand Down
17 changes: 5 additions & 12 deletions .github/workflows/cpufeatures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ concurrency:
cancel-in-progress: true

jobs:
minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
# minimal-versions:
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
# with:
# working-directory: ${{ github.workflow }}

# Linux tests
linux:
Expand Down Expand Up @@ -56,8 +57,6 @@ jobs:
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
- run: rm ../Cargo.toml
- run: ${{ matrix.deps }}
- run: cargo test --target ${{ matrix.target }}

Expand All @@ -76,8 +75,6 @@ jobs:
with:
toolchain: ${{ matrix.toolchain }}
targets: x86_64-apple-darwin
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
- run: rm ../Cargo.toml
- run: cargo test

# Windows tests
Expand All @@ -98,8 +95,6 @@ jobs:
with:
toolchain: ${{ matrix.toolchain }}
targets: ${{ matrix.target }}
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
- run: rm ../Cargo.toml
- run: cargo test --target ${{ matrix.target }}

# Cross-compiled tests
Expand All @@ -121,8 +116,6 @@ jobs:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- uses: RustCrypto/actions/cross-install@master
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
- run: rm ../Cargo.toml
- run: cross test --target ${{ matrix.target }}

# Build-only tests
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/dbl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,11 @@ jobs:
targets: ${{ matrix.target }}
- run: cargo build --target ${{ matrix.target }}

minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
# minimal-versions:
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
# with:
# working-directory: ${{ github.workflow }}

test:
runs-on: ubuntu-latest
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/hex-literal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: hex-literal

on:
pull_request:
paths:
- "hex-literal/**"
- "Cargo.*"
paths:
- "hex-literal/**"
- "Cargo.*"
push:
branches: master

Expand Down Expand Up @@ -42,14 +42,13 @@ jobs:
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
- run: rm ../Cargo.toml
- run: cargo build --target ${{ matrix.target }}

minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
# minimal-versions:
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
# with:
# working-directory: ${{ github.workflow }}

test:
runs-on: ubuntu-latest
Expand All @@ -64,6 +63,4 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
- run: rm ../Cargo.toml
- run: cargo test
15 changes: 8 additions & 7 deletions .github/workflows/inout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: inout

on:
pull_request:
paths:
- "inout/**"
- "Cargo.*"
paths:
- "inout/**"
- "Cargo.*"
push:
branches: master

Expand Down Expand Up @@ -45,10 +45,11 @@ jobs:
- run: cargo build --target ${{ matrix.target }}
- run: cargo build --features block-padding --target ${{ matrix.target }}

minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
# minimal-versions:
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
# with:
# working-directory: ${{ github.workflow }}

test:
runs-on: ubuntu-latest
Expand Down
15 changes: 3 additions & 12 deletions .github/workflows/opaque-debug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: opaque-debug

on:
pull_request:
paths:
- "opaque-debug/**"
- "Cargo.*"
paths:
- "opaque-debug/**"
- "Cargo.*"
push:
branches: master

Expand Down Expand Up @@ -42,15 +42,8 @@ jobs:
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
- run: rm ../Cargo.toml
- run: cargo build --target ${{ matrix.target }}

minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}

test:
runs-on: ubuntu-latest
strategy:
Expand All @@ -64,6 +57,4 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
# Isolate this crate from workspace which is otherwise MSRV 1.56 due to 2021 edition crates
- run: rm ../Cargo.toml
- run: cargo test
9 changes: 5 additions & 4 deletions .github/workflows/zeroize.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ jobs:
targets: ${{ matrix.target }}
- run: cargo build --no-default-features --target ${{ matrix.target }}

minimal-versions:
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}
# TODO(tarcieri): disabled until it can be made compatible with workspace-level lints
# minimal-versions:
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
# with:
# working-directory: ${{ github.workflow }}

test:
strategy:
Expand Down
41 changes: 41 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,44 @@ opt-level = 2

[patch.crates-io]
cmov = { path = "cmov" }

[workspace.lints.clippy]
borrow_as_ptr = "warn"
cast_lossless = "warn"
cast_possible_truncation = "warn"
cast_possible_wrap = "warn"
cast_precision_loss = "warn"
cast_sign_loss = "warn"
checked_conversions = "warn"
doc_markdown = "warn"
from_iter_instead_of_collect = "warn"
manual_assert = "warn"
map_unwrap_or = "warn"
missing_errors_doc = "warn"
missing_panics_doc = "warn"
mod_module_files = "warn"
must_use_candidate = "warn"
needless_range_loop = "allow"
implicit_saturating_sub = "warn"
panic_in_result_fn = "warn"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about usefulness of the panic_in_result_fn lint in our context.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I marked a couple of my crates as clippy::panic in this PR. panic_in_result_fn is a bit more manageable. It also won't trip on const asserts.

I'm fine with removing it from the workspace-level, but it does seem good to me. At one point I was trying my best to write panic-free code but the lack of tooling to ensure that's actually the case is somewhat demotivating.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC the lint did not result in any fixes in our code and I can not recall a single case where it could've been legitimate, so I think it's better to remove it and associated allows.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can remove it, but the general idea that something which returns Result probably shouldn't panic if possible seems like a good one to me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, sure. But in practice we use Result for cases when user is responsible for the error and panics to guard against potential bugs in our code. Most of such panics get eliminated by optimization passes, but Clippy is unable to see it.

ptr_as_ptr = "warn"
redundant_closure_for_method_calls = "warn"
ref_as_ptr = "warn"
return_self_not_must_use = "warn"
semicolon_if_nothing_returned = "warn"
trivially_copy_pass_by_ref = "warn"
std_instead_of_alloc = "warn"
std_instead_of_core = "warn"
undocumented_unsafe_blocks = "warn"
unnecessary_safety_comment = "warn"
unwrap_in_result = "warn"
unwrap_used = "warn"

[workspace.lints.rust]
missing_copy_implementations = "warn"
missing_debug_implementations = "warn"
missing_docs = "warn"
trivial_casts = "warn"
trivial_numeric_casts = "warn"
unused_lifetimes = "warn"
unused_qualifications = "warn"
3 changes: 3 additions & 0 deletions blobby/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ description = "Iterator over simple binary blob storage"

[features]
alloc = []

[lints]
workspace = true
2 changes: 1 addition & 1 deletion blobby/src/bin/decode.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Encoding utility
use std::error::Error;
use core::error::Error;

#[cfg(not(feature = "alloc"))]
fn main() -> Result<(), Box<dyn Error>> {
Expand Down
2 changes: 1 addition & 1 deletion blobby/src/bin/encode.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Encoding utility
use std::error::Error;
use core::error::Error;

#[cfg(not(feature = "alloc"))]
fn main() -> Result<(), Box<dyn Error>> {
Expand Down
Loading