Skip to content

Commit 125ade5

Browse files
fix clippy 1.93.0 (#6836)
* fix clippy 1.93.0 * Auto-format: cargo fmt --all --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 11a59bb commit 125ade5

5 files changed

Lines changed: 15 additions & 9 deletions

File tree

crates/stdlib/src/faulthandler.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,7 +553,7 @@ mod decl {
553553
}
554554

555555
let mut action: libc::sigaction = core::mem::zeroed();
556-
action.sa_sigaction = faulthandler_fatal_error as libc::sighandler_t;
556+
action.sa_sigaction = faulthandler_fatal_error as *const () as libc::sighandler_t;
557557
// SA_NODEFER flag
558558
action.sa_flags = libc::SA_NODEFER;
559559

@@ -583,7 +583,7 @@ mod decl {
583583

584584
handler.previous = libc::signal(
585585
handler.signum,
586-
faulthandler_fatal_error as libc::sighandler_t,
586+
faulthandler_fatal_error as *const () as libc::sighandler_t,
587587
);
588588

589589
// SIG_ERR is -1 as sighandler_t (which is usize on Windows)
@@ -937,7 +937,10 @@ mod decl {
937937
libc::signal(signum, user.previous);
938938
libc::raise(signum);
939939
// Re-register our handler
940-
libc::signal(signum, faulthandler_user_signal as libc::sighandler_t);
940+
libc::signal(
941+
signum,
942+
faulthandler_user_signal as *const () as libc::sighandler_t,
943+
);
941944
}
942945
}
943946
}
@@ -988,7 +991,10 @@ mod decl {
988991
let previous = if !user_signals::is_enabled(signum) {
989992
// Install signal handler
990993
let prev = unsafe {
991-
libc::signal(args.signum, faulthandler_user_signal as libc::sighandler_t)
994+
libc::signal(
995+
args.signum,
996+
faulthandler_user_signal as *const () as libc::sighandler_t,
997+
)
992998
};
993999
if prev == libc::SIG_ERR {
9941000
return Err(vm.new_os_error(format!(

crates/vm/src/class.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ pub fn add_operators(class: &'static Py<PyType>, ctx: &Context) {
2828
.slots
2929
.hash
3030
.load()
31-
.is_some_and(|h| h as usize == hash_not_implemented as usize)
31+
.is_some_and(|h| h as usize == hash_not_implemented as *const () as usize)
3232
{
3333
class.set_attr(ctx.names.__hash__, ctx.none.clone().into());
3434
continue;

crates/vm/src/stdlib/ctypes.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,13 +964,13 @@ pub(crate) mod _ctypes {
964964
#[pyattr]
965965
fn _memmove_addr(_vm: &VirtualMachine) -> usize {
966966
let f = libc::memmove;
967-
f as usize
967+
f as *const () as usize
968968
}
969969

970970
#[pyattr]
971971
fn _memset_addr(_vm: &VirtualMachine) -> usize {
972972
let f = libc::memset;
973-
f as usize
973+
f as *const () as usize
974974
}
975975

976976
#[pyattr]

crates/vm/src/stdlib/signal.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ pub(crate) mod _signal {
202202
match usize::try_from_borrowed_object(vm, &handler).ok() {
203203
Some(SIG_DFL) => SIG_DFL,
204204
Some(SIG_IGN) => SIG_IGN,
205-
None if handler.is_callable() => run_signal as sighandler_t,
205+
None if handler.is_callable() => run_signal as *const () as sighandler_t,
206206
_ => return Err(vm.new_type_error(
207207
"signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object",
208208
)),

crates/vm/src/vm/method.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl PyMethod {
2222
pub fn get(obj: PyObjectRef, name: &Py<PyStr>, vm: &VirtualMachine) -> PyResult<Self> {
2323
let cls = obj.class();
2424
let getattro = cls.slots.getattro.load().unwrap();
25-
if getattro as usize != PyBaseObject::getattro as usize {
25+
if getattro as usize != PyBaseObject::getattro as *const () as usize {
2626
return obj.get_attr(name, vm).map(Self::Attribute);
2727
}
2828

0 commit comments

Comments
 (0)