Skip to content

Commit

Permalink
fix: allow 2 expect!
Browse files Browse the repository at this point in the history
  • Loading branch information
jessekrubin committed Feb 21, 2025
1 parent 0b1839a commit 2137ccc
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 18 deletions.
2 changes: 1 addition & 1 deletion crates/ryo3-core/src/pystring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use pyo3::types::PyString;
#[must_use]
pub fn pystring_fast_new<'py>(py: Python<'py>, s: &str, ascii_only: bool) -> Bound<'py, PyString> {
if ascii_only {
#[allow(unsafe_code)]
#[expect(unsafe_code)]
unsafe {
pystring_ascii_new(py, s)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/ryo3-globset/src/globster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl PyGlobster {
}
}

#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
#[pyo3(name = "is_match")]
#[must_use]
pub fn py_is_match(&self, path: PathLike) -> bool {
Expand Down
9 changes: 3 additions & 6 deletions crates/ryo3-std/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,21 +140,18 @@ impl PyMetadata {
// FUNCTIONS
// ============================================================================

#[allow(clippy::needless_pass_by_value)]
#[pyfunction]
pub fn read(pth: PathLike) -> PyResult<ryo3_bytes::PyBytes> {
let fbytes = std::fs::read(pth)?;
Ok(fbytes.into())
}

#[allow(clippy::needless_pass_by_value)]
#[pyfunction]
pub fn read_bytes(py: Python<'_>, s: PathLike) -> PyResult<PyObject> {
let fbytes = std::fs::read(s)?;
Ok(PyBytes::new(py, &fbytes).into())
}

#[allow(clippy::needless_pass_by_value)]
#[pyfunction]
pub fn read_text(py: Python<'_>, s: PathLike) -> PyResult<String> {
let fbytes = std::fs::read(s)?;
Expand All @@ -168,7 +165,7 @@ pub fn read_text(py: Python<'_>, s: PathLike) -> PyResult<String> {
}
}

#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
#[pyfunction]
pub fn write(fspath: PathLike, b: &Bound<'_, PyAny>) -> PyResult<usize> {
let bref = extract_bytes_ref_str(b)?;
Expand All @@ -181,7 +178,7 @@ pub fn write(fspath: PathLike, b: &Bound<'_, PyAny>) -> PyResult<usize> {
}
}

#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
#[pyfunction]
pub fn write_bytes(fspath: PathLike, b: &[u8]) -> PyResult<usize> {
let write_res = std::fs::write(fspath.as_ref(), b);
Expand All @@ -193,7 +190,7 @@ pub fn write_bytes(fspath: PathLike, b: &[u8]) -> PyResult<usize> {
}
}

#[allow(clippy::needless_pass_by_value)]
#[expect(clippy::needless_pass_by_value)]
#[pyfunction]
pub fn write_text(fspath: PathLike, string: &str) -> PyResult<usize> {
let str_bytes = string.as_bytes();
Expand Down
14 changes: 7 additions & 7 deletions crates/ryo3-std/src/time/duration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,42 +28,42 @@ impl PyDuration {
fn py_new(secs: u64, nanos: u32) -> Self {
PyDuration(Duration::new(secs, nanos))
}
#[allow(non_snake_case)]
#[expect(non_snake_case)]
#[classattr]
fn ZERO() -> Self {
Self(Duration::ZERO)
}
#[allow(non_snake_case)]
#[expect(non_snake_case)]
#[classattr]
fn MIN() -> Self {
Self(Duration::ZERO)
}

#[allow(non_snake_case)]
#[expect(non_snake_case)]
#[classattr]
fn MAX() -> Self {
Self(Duration::MAX)
}

#[allow(non_snake_case)]
#[expect(non_snake_case)]
#[classattr]
fn SECOND() -> Self {
Self(Duration::from_secs(1))
}

#[allow(non_snake_case)]
#[expect(non_snake_case)]
#[classattr]
fn MILLISECOND() -> Self {
Self(Duration::from_millis(1))
}

#[allow(non_snake_case)]
#[expect(non_snake_case)]
#[classattr]
fn MICROSECOND() -> Self {
Self(Duration::from_micros(1))
}

#[allow(non_snake_case)]
#[expect(non_snake_case)]
#[classattr]
fn NANOSECOND() -> Self {
Self(Duration::from_nanos(1))
Expand Down
2 changes: 0 additions & 2 deletions crates/ryo3-tokio/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use pyo3::prelude::*;
use ryo3_bytes::PyBytes;
use std::path::PathBuf;

#[allow(clippy::needless_pass_by_value)]
#[pyfunction]
pub fn read_async(py: Python<'_>, pth: PathBuf) -> PyResult<Bound<'_, PyAny>> {
pyo3_async_runtimes::tokio::future_into_py(py, async move {
Expand All @@ -15,7 +14,6 @@ pub fn read_async(py: Python<'_>, pth: PathBuf) -> PyResult<Bound<'_, PyAny>> {
})
}

#[allow(clippy::needless_pass_by_value)]
#[pyfunction]
pub fn write_async(py: Python<'_>, fspath: PathBuf, b: PyBytes) -> PyResult<Bound<'_, PyAny>> {
pyo3_async_runtimes::tokio::future_into_py(py, async move {
Expand Down
2 changes: 1 addition & 1 deletion crates/ryo3-walkdir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn build_walkdir(
wd
}

#[allow(clippy::too_many_arguments)]
#[expect(clippy::too_many_arguments)]
#[pyfunction]
#[pyo3(
signature = (
Expand Down

0 comments on commit 2137ccc

Please sign in to comment.