Skip to content

Commit 8be67af

Browse files
Merge branch 'fix-clippy' into c-api-more-error
2 parents 6d1ac15 + d3f79d5 commit 8be67af

8 files changed

Lines changed: 28 additions & 2 deletions

File tree

crates/host_env/src/fileutils.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,10 @@ pub unsafe fn fclose(fp: *mut CFile) -> core::ffi::c_int {
457457
// _Py_fopen_obj in cpython (Python/fileutils.c:1757-1835)
458458
// Open a file using std::fs::File and convert to FILE*
459459
// Automatically handles path encoding and EINTR retries
460+
#[expect(
461+
clippy::std_instead_of_core,
462+
reason = "false positive: core::io::ErrorKind is unstable (core_io)"
463+
)]
460464
pub fn fopen(path: &std::path::Path, mode: &str) -> std::io::Result<*mut CFile> {
461465
use alloc::ffi::CString;
462466
use std::fs::File;

crates/host_env/src/posix.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,10 @@ pub fn fchown(fd: BorrowedFd<'_>, uid: Option<u32>, gid: Option<u32>) -> std::io
305305
}
306306

307307
#[cfg(not(windows))]
308+
#[expect(
309+
clippy::std_instead_of_core,
310+
reason = "false positive: core::io::ErrorKind is unstable (core_io)"
311+
)]
308312
pub fn stat_path(
309313
path: &OsStr,
310314
dir_fd: Option<i32>,
@@ -1431,6 +1435,10 @@ fn build_posix_spawn_attrs(
14311435
target_os = "illumos",
14321436
target_os = "hurd",
14331437
)))]
1438+
#[expect(
1439+
clippy::std_instead_of_core,
1440+
reason = "false positive: core::io::ErrorKind is unstable (core_io); expect is co-gated with the usage so it is not left unfulfilled on platforms where this block is compiled out"
1441+
)]
14341442
{
14351443
return Err(std::io::Error::new(
14361444
std::io::ErrorKind::Unsupported,

crates/stdlib/src/binascii.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,7 @@ mod decl {
392392
// there are a few uuencodes out there that use
393393
// '`' as zero instead of space.
394394
if !(b' '..=(b' ' + 64)).contains(&c) {
395-
if [b'\r', b'\n'].contains(&c) {
395+
if b"\r\n".contains(&c) {
396396
return Ok(0);
397397
}
398398
return Err(super::new_binascii_error("Illegal char", vm));

crates/stdlib/src/pyexpat.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//! Pyexpat builtin module
22
3+
// false positive: core::io::Cursor is unstable (core_io), unusable on stable
4+
#![expect(clippy::std_instead_of_core)]
5+
36
// spell-checker: ignore libexpat
47

58
pub(crate) use _pyexpat::module_def;

crates/stdlib/src/ssl.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
//!
1414
//! Warning: This library contains AI-generated code and comments. Do not trust any code or comment without verification. Please have a qualified expert review the code and remove this notice after review.
1515
16+
// false positive: core::io::{Cursor, ErrorKind} are unstable (core_io), unusable on stable
17+
#![expect(clippy::std_instead_of_core)]
18+
1619
// OID (Object Identifier) management module
1720
mod oid;
1821

crates/vm/src/exceptions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2652,7 +2652,7 @@ pub(super) mod types {
26522652
Ok(vm.ctx.new_str(if start < object.len() && end <= object.len() && end == start + 1 {
26532653
let b = object.borrow_buf()[start];
26542654
format!(
2655-
"'{encoding}' codec can't decode byte {b:#02x} in position {start}: {reason}"
2655+
"'{encoding}' codec can't decode byte {b:#04x} in position {start}: {reason}"
26562656
)
26572657
} else {
26582658
format!(

crates/vm/src/stdlib/_io.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ impl std::os::fd::AsRawFd for Fildes {
112112
}
113113

114114
#[pymodule]
115+
#[expect(
116+
clippy::std_instead_of_core,
117+
reason = "false positive: core::io items (Cursor, etc.) are unstable (core_io)"
118+
)]
115119
mod _io {
116120
use super::*;
117121
use crate::{

crates/vm/src/stdlib/_signal.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,10 @@ pub(crate) mod _signal {
335335
}
336336

337337
#[cfg(windows)]
338+
#[expect(
339+
clippy::std_instead_of_core,
340+
reason = "false positive: core::io::ErrorKind is unstable (core_io)"
341+
)]
338342
let is_socket = if fd != INVALID_WAKEUP {
339343
host_signal::wakeup_fd_is_socket(fd).map_err(|err| {
340344
if err.kind() == std::io::ErrorKind::InvalidInput {

0 commit comments

Comments
 (0)