Skip to content

Commit 440fbc7

Browse files
bjorn3squell
authored andcommitted
Fix a lint warning introduced on nightly
The new function_casts_as_integer lint warns on direct casts from function items to integers as those sometimes indicate a bug in the program. In our case the cast is however correct, so silence the lint by first casting to *const () as suggested by the lint. Also fix a todo now that we use a newer clippy version.
1 parent 09635ec commit 440fbc7

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/pam/rpassword.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ fn read_unbuffered(
126126

127127
// invariant: the amount of nonzero-bytes in the buffer correspond
128128
// with the amount of asterisks on the terminal (both tracked in `pw_len`)
129-
//TODO: we actually only want to allow clippy::unbuffered_bytes
130-
#[allow(clippy::perf)]
129+
#[allow(clippy::unbuffered_bytes)]
131130
for read_byte in source.bytes() {
132131
let read_byte = read_byte?;
133132

src/system/signal/set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl SignalAction {
2424
// Specify that we want to pass a signal-catching function in `sa_sigaction`.
2525
sa_flags |= libc::SA_SIGINFO;
2626
(
27-
super::stream::send_siginfo as libc::sighandler_t,
27+
super::stream::send_siginfo as *const () as libc::sighandler_t,
2828
SignalSet::full()?,
2929
)
3030
}

src/system/term/user_term.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fn catching_sigttou(mut function: impl FnMut() -> io::Result<()>) -> io::Result<
8585
let action = {
8686
let mut raw: libc::sigaction = make_zeroed_sigaction();
8787
// Call `on_sigttou` if `SIGTTOU` arrives.
88-
raw.sa_sigaction = on_sigttou as sighandler_t;
88+
raw.sa_sigaction = on_sigttou as *const () as sighandler_t;
8989
// Exclude any other signals from the set
9090
raw.sa_mask = {
9191
let mut sa_mask = MaybeUninit::<sigset_t>::uninit();

0 commit comments

Comments
 (0)