Skip to content

Commit c292bab

Browse files
committed
fix: use expect attributes instead of allow
1 parent a475b6d commit c292bab

20 files changed

+29
-27
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ jobs:
103103
rustup install --profile default nightly
104104
rustup default nightly
105105
- uses: Swatinem/rust-cache@v2
106-
- run: cargo clippy --all-targets
106+
- run: cargo clippy --all-targets -- -D warnings

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ version_check = "0.9.5"
4747
[lints.clippy]
4848
module_name_repetitions = { level = "allow", priority = 1 }
4949
too_long_first_doc_paragraph = { level = "allow", priority = 1 } # Temporary
50-
pedantic = { level = "deny", priority = 0 }
50+
pedantic = "deny"
51+
# Do not activate until Clippy issue #13356 is fixed
52+
#allow_attributes = "deny"
5153

5254
[[bench]]
5355
name = "algos"

benches/matrices.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use codspeed_criterion_compat::{criterion_group, criterion_main, Criterion};
22
use pathfinding::matrix::Matrix;
33

4-
#[allow(clippy::missing_panics_doc)]
4+
#[expect(clippy::missing_panics_doc)]
55
pub fn transpose_benchmark(c: &mut Criterion) {
66
// Generate a 100 x 100 square matrix with entries from 1 to 100^2
77
let data: Vec<i32> = (0..100 * 100).collect();
@@ -10,7 +10,7 @@ pub fn transpose_benchmark(c: &mut Criterion) {
1010
c.bench_function("transpose", |b| b.iter(|| m.transpose()));
1111
}
1212

13-
#[allow(clippy::missing_panics_doc)]
13+
#[expect(clippy::missing_panics_doc)]
1414
pub fn transpose_non_square_benchmark(c: &mut Criterion) {
1515
// Generate a 1000 x 10 square matrix with entries from 1 to 100^2
1616
let data: Vec<i32> = (0..100 * 100).collect();

benches/movingai.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ use noisy_float::prelude::*;
77
use pathfinding::directed::astar::astar;
88
use std::path::Path;
99

10-
#[allow(clippy::cast_precision_loss)]
10+
#[expect(clippy::cast_precision_loss)]
1111
fn distance(a: &Coords2D, b: &Coords2D) -> R64 {
1212
r64((a.0 as f64 - b.0 as f64).hypot(a.1 as f64 - b.1 as f64))
1313
}
1414

15-
#[allow(clippy::missing_panics_doc)]
15+
#[expect(clippy::missing_panics_doc)]
1616
pub fn arena(c: &mut Criterion) {
1717
c.bench_function("arena", |b| {
1818
b.iter(|| {

examples/sliding-puzzle.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ const SIDE: u8 = 3;
1212
const SIDE: u8 = 4;
1313
const LIMIT: usize = (SIDE * SIDE) as usize;
1414

15-
#[allow(clippy::derived_hash_with_manual_eq)]
1615
#[derive(Clone, Debug, Hash)]
16+
#[allow(clippy::derived_hash_with_manual_eq)] // expect doesn't work, clippy issue #13356
1717
struct Game {
1818
positions: [u8; LIMIT], // Correct position of piece at every index
1919
hole_idx: u8, // Current index of the hole

src/directed/astar.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use crate::FxIndexMap;
7777
/// |&p| p == GOAL);
7878
/// assert_eq!(result.expect("no path found").1, 4);
7979
/// ```
80-
#[allow(clippy::missing_panics_doc)]
80+
#[expect(clippy::missing_panics_doc)]
8181
pub fn astar<N, C, FN, IN, FH, FS>(
8282
start: &N,
8383
mut successors: FN,
@@ -169,7 +169,7 @@ where
169169
///
170170
/// Each path comprises both the start and an end node. Note that while every path shares the same
171171
/// start node, different paths may have different end nodes.
172-
#[allow(clippy::missing_panics_doc)]
172+
#[expect(clippy::missing_panics_doc)]
173173
pub fn astar_bag<N, C, FN, IN, FH, FS>(
174174
start: &N,
175175
mut successors: FN,

src/directed/dijkstra.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ where
168168
///
169169
/// The [`build_path`] function can be used to build a full path from the starting point to one
170170
/// of the reachable targets.
171-
#[allow(clippy::missing_panics_doc)]
171+
#[expect(clippy::missing_panics_doc)]
172172
pub fn dijkstra_partial<N, C, FN, IN, FS>(
173173
start: &N,
174174
mut successors: FN,
@@ -277,7 +277,7 @@ where
277277
/// assert_eq!(vec![1], build_path(&1, &parents));
278278
/// assert_eq!(vec![101], build_path(&101, &parents));
279279
/// ```
280-
#[allow(clippy::implicit_hasher)]
280+
#[expect(clippy::implicit_hasher)]
281281
pub fn build_path<N, C>(target: &N, parents: &HashMap<N, (N, C)>) -> Vec<N>
282282
where
283283
N: Eq + Hash + Clone,

src/directed/fringe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ use std::mem;
7777
/// |&p| p == GOAL);
7878
/// assert_eq!(result.expect("no path found").1, 4);
7979
/// ```
80-
#[allow(clippy::missing_panics_doc)]
80+
#[expect(clippy::missing_panics_doc)]
8181
pub fn fringe<N, C, FN, IN, FH, FS>(
8282
start: &N,
8383
mut successors: FN,

src/directed/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ pub mod strongly_connected_components;
1717
pub mod topological_sort;
1818
pub mod yen;
1919

20-
#[allow(clippy::needless_collect)]
20+
#[expect(clippy::needless_collect)]
2121
fn reverse_path<N, V, F>(parents: &FxIndexMap<N, V>, mut parent: F, start: usize) -> Vec<N>
2222
where
2323
N: Eq + Hash + Clone,

src/directed/strongly_connected_components.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ where
104104
///
105105
/// The function returns the strongly connected component containing the node,
106106
/// which is guaranteed to contain at least `node`.
107-
#[allow(clippy::missing_panics_doc)]
107+
#[expect(clippy::missing_panics_doc)]
108108
pub fn strongly_connected_component<N, FN, IN>(node: &N, successors: FN) -> Vec<N>
109109
where
110110
N: Clone + Hash + Eq,

0 commit comments

Comments
 (0)