Skip to content

Commit

Permalink
Expect lints (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessekrubin authored Feb 12, 2025
1 parent 70cf72e commit 5b89ab0
Show file tree
Hide file tree
Showing 44 changed files with 154 additions and 323 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

- `jiff`
- Upgraded jiff to version 2
- internal
- Switch all lints from `#[allow(...)]`/`#![allow(...)]` to `#[expect(...)]`/`#![expect(...)]`
- Removed a bunch o commented out code

___

Expand Down
12 changes: 5 additions & 7 deletions crates/_ryo3-dev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@
#![deny(clippy::style)]
#![deny(clippy::unwrap_used)]
#![warn(clippy::must_use_candidate)]
#![allow(clippy::missing_errors_doc)]
#![allow(clippy::missing_panics_doc)]
#![allow(clippy::unnecessary_wraps)]
#![allow(clippy::needless_pass_by_value)]
#![allow(clippy::module_name_repetitions)]
#![allow(clippy::unused_self)]
#![allow(clippy::unwrap_used)]
#![expect(clippy::missing_errors_doc)]
#![expect(clippy::missing_panics_doc)]
#![expect(clippy::unnecessary_wraps)]
#![expect(clippy::module_name_repetitions)]
#![expect(clippy::unwrap_used)]

use pyo3::prelude::*;
use pyo3::types::PyModule;
Expand Down
1 change: 0 additions & 1 deletion crates/ryo3-brotli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ pub fn brotli_encode(
..Default::default()
};
let mut encoder = br::CompressorWriter::with_params(Vec::new(), 4 * 1024, &params);
// let mut encoder = br::CompressorWriter::new(Vec::new(), 4 * 1024, 11, 22);
encoder.write_all(data).map_err(|e| {
PyErr::new::<pyo3::exceptions::PyValueError, _>(format!("Error: {e:?}"))
})?;
Expand Down
2 changes: 0 additions & 2 deletions crates/ryo3-bytes/src/bytes_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ impl PyBytes {
errors: &str,
) -> PyResult<Bound<'py, PyString>> {
let a = slf.into_bound_py_any(py)?;
// let enc_c = std::ffi::CString::new(encoding).map_err(PyValueError::new_err)?;
// let err_c = std::ffi::CString::new(errors).map_err(PyValueError::new_err)?;
// ensure str is null-term
let encoding = {
let mut enc = encoding.to_owned();
Expand Down
26 changes: 2 additions & 24 deletions crates/ryo3-fspath/src/fspath.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//! `FsPath` struct python module
#![allow(clippy::unused_self)] // TODO: remove in future
#![allow(clippy::needless_pass_by_value)]
// TODO: remove in future? if possible?
use pyo3::basic::CompareOp;
Expand Down Expand Up @@ -39,6 +37,8 @@ fn path2str<P: AsRef<Path>>(p: P) -> String {
p.as_ref().display().to_string()
}

#[expect(clippy::needless_pass_by_value)]
#[expect(clippy::unused_self)]
#[pymethods]
impl PyFsPath {
#[new]
Expand Down Expand Up @@ -81,16 +81,6 @@ impl PyFsPath {
hasher.finish()
}

// fn __eq__(&self, other: PathLike) -> bool {
// // start by comparing as paths
// if self.pth == other.as_ref() {
// return true;
// }
// // if that fails, compare as strings
// self.string() == path2str(other.as_ref())
// }

#[allow(clippy::needless_pass_by_value)]
fn __richcmp__(&self, other: PathLike, op: CompareOp) -> bool {
let o = other.as_ref();
match op {
Expand All @@ -117,11 +107,6 @@ impl PyFsPath {
}
}

// fn __ne__(&self, other: PathLike) -> bool {
// // let other = other.extract::<PyPath>().unwrap();
// self.pth != other.as_ref()
// }

fn absolute(&self) -> PyResult<Self> {
let p = self.pth.canonicalize()?;
Ok(PyFsPath::from(p))
Expand Down Expand Up @@ -176,10 +161,6 @@ impl PyFsPath {
}
None => None,
}
// #[cfg(not(target_os = "windows"))]
// {
// Ok(None)
// }
}

#[cfg(not(target_os = "windows"))]
Expand Down Expand Up @@ -540,9 +521,6 @@ impl PyFsPath {
self.pth.is_symlink()
}

// fn iter(&self) -> PyResult<()> {
// err_py_not_impl!()
// }
fn join(&self, p: PathLike) -> PyFsPath {
Self::from(self.pth.join(p))
}
Expand Down
2 changes: 0 additions & 2 deletions crates/ryo3-fspath/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
//! `FsPath` python module
#![allow(clippy::needless_pass_by_value)] // TODO: remove in future? if possible?

mod fspath;

use crate::fspath::PyFsPath;
Expand Down
5 changes: 1 addition & 4 deletions crates/ryo3-globset/src/globster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,7 @@ impl PyGlobster {

pub fn is_match(&self, path: PathLike) -> bool {
match (&self.0.globset, &self.0.nglobset) {
(Some(gs), Some(ngs)) => {
// let path = path.to_string();
gs.is_match(&path) && !ngs.is_match(&path)
}
(Some(gs), Some(ngs)) => gs.is_match(&path) && !ngs.is_match(&path),
(Some(gs), None) => gs.is_match(&path),
(None, Some(ngs)) => !ngs.is_match(&path),
_ => false,
Expand Down
Loading

0 comments on commit 5b89ab0

Please sign in to comment.