Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove or move allow attributes #607

Merged
merged 1 commit into from
Oct 6, 2024
Merged
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
3 changes: 1 addition & 2 deletions benches/movingai.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
// Test with files from https://movingai.com/benchmarks/

#![allow(clippy::cast_precision_loss)]

use codspeed_criterion_compat::{criterion_group, criterion_main, Criterion};
use movingai::parser::{parse_map_file, parse_scen_file};
use movingai::{Coords2D, Map2D};
use noisy_float::prelude::*;
use pathfinding::directed::astar::astar;
use std::path::Path;

#[allow(clippy::cast_precision_loss)]
fn distance(a: &Coords2D, b: &Coords2D) -> R64 {
r64((a.0 as f64 - b.0 as f64).hypot(a.1 as f64 - b.1 as f64))
}
Expand Down
7 changes: 3 additions & 4 deletions examples/sliding-puzzle.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![allow(clippy::cast_possible_truncation)]

use itertools::Itertools;
use lazy_static::lazy_static;
use pathfinding::prelude::{astar, idastar};
Expand Down Expand Up @@ -37,7 +35,7 @@ lazy_static! {
positions: {
let mut p = [0u8; LIMIT];
for (i, e) in p.iter_mut().enumerate() {
*e = i as u8;
*e = u8::try_from(i).unwrap();
}
p
},
Expand Down Expand Up @@ -125,7 +123,8 @@ impl Game {
}

fn from_array(positions: [u8; LIMIT]) -> Game {
let hole_idx = positions.iter().find_position(|&&n| n == 0).unwrap().0 as u8;
let hole_idx =
u8::try_from(positions.iter().find_position(|&&n| n == 0).unwrap().0).unwrap();
let mut game = Game {
positions,
hole_idx,
Expand Down
1 change: 0 additions & 1 deletion src/directed/edmonds_karp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use std::collections::{BTreeMap, BTreeSet, VecDeque};
use std::hash::Hash;

/// Type alias for Edmonds-Karp maximum flow result.
#[allow(clippy::upper_case_acronyms)]
pub type EKFlows<N, C> = (Vec<Edge<N, C>>, C, Vec<Edge<N, C>>);

/// Type alias for representing an edge in a graph
Expand Down
1 change: 0 additions & 1 deletion src/matrix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ impl<C: Clone> Matrix<C> {
///
/// [`MatrixFormatError::WrongIndex`] if the ranges
/// are outside the original matrix.
#[allow(clippy::needless_pass_by_value)]
pub fn slice(
&self,
rows: Range<usize>,
Expand Down
5 changes: 0 additions & 5 deletions src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,6 @@ use num_traits::{PrimInt, Unsigned};
/// assert_eq!(uint_sqrt(100usize), Some(10));
/// assert_eq!(uint_sqrt(10usize), None);
/// ```
#[allow(
clippy::cast_possible_truncation,
clippy::cast_precision_loss,
clippy::cast_sign_loss
)]
pub fn uint_sqrt<T>(n: T) -> Option<T>
where
T: PrimInt + Unsigned,
Expand Down
3 changes: 1 addition & 2 deletions tests/codejam-2017-a.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Problem A from the Google Code Jam finals 2017.
// https://code.google.com/codejam/contest/dashboard?c=6314486#s=p0&a=0

#![allow(clippy::cast_sign_loss)]

use pathfinding::prelude::*;
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use std::io::prelude::*;
Expand Down Expand Up @@ -101,6 +99,7 @@ fn test<EK: EdmondsKarp<i32>>(n: usize, file: &mut dyn BufRead) -> Result<String
loop {
let (_, n, _) = ek.augment();
debug_assert!(n >= 0);
#[allow(clippy::cast_sign_loss)]
let n = n as usize;
if n > max {
max = n;
Expand Down
2 changes: 1 addition & 1 deletion tests/gps.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![cfg(test)]
#![allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)]

use pathfinding::prelude::*;
use std::collections::HashMap;
Expand All @@ -16,6 +15,7 @@ impl Coords {
self.1.to_radians()
}

#[allow(clippy::cast_possible_truncation, clippy::cast_sign_loss)]
fn distance_in_meters(&self, other: &Coords) -> u64 {
let x =
(other.lon_rad() - self.lon_rad()) * ((other.lat_rad() + self.lat_rad()) / 2.0).cos();
Expand Down
Loading