Fix lints and warnings

This commit is contained in:
David Lönnhager
2026-03-06 10:20:52 +01:00
parent 2ad80abdae
commit 9ecf22e7e9
6 changed files with 22 additions and 15 deletions

View File

@@ -153,6 +153,13 @@ non_ascii_idents = "forbid"
# Deny old style Rust
rust_2018_idioms = { level = "deny", priority = -1 }
single_use_lifetimes = "warn"
# The `class!` macro in `objc` uses an unknown feature. We rely on this in 'installer-downloader'.
# The unexpected cfg warning stems from https://github.com/SSheldon/rust-objc/issues/125
# We need to ignore this until cacao migrates to another objc implementation,
# or we use another `msg_send!` macro ourselves.
unexpected_cfgs = { level = "warn", check-cfg = [
'cfg(feature, values("cargo-clippy"))'
] }
unused_lifetimes = "warn"
unused_macro_rules = "warn"

View File

@@ -41,11 +41,6 @@ static BANNER_COLOR: LazyLock<Color> = LazyLock::new(|| {
// calibrated uses the current color profile.
// Maybe using calibrated colors is more correct? Rendering different colors *definitely*
// is not.
// ---
// The unexpected cfg warning stems from https://github.com/SSheldon/rust-objc/issues/125
// We need to ignore this until cacao migrates to another objc implementation,
// or we use another `msg_send!` macro ourselves.
#[expect(unexpected_cfgs)]
let id =
// SAFETY: This function returns a pointer to a refcounted NSColor instance, and panics if
// a null pointer is passed.

View File

@@ -1250,6 +1250,7 @@ impl ManagementService for ManagementServiceImpl {
) -> ServiceResult<Self::AppUpgradeEventsListenStream> {
log::debug!("app_upgrade_events_listen");
let rx = self.app_upgrade_broadcast.subscribe();
#[expect(clippy::result_large_err)]
let upgrade_event_stream =
tokio_stream::wrappers::BroadcastStream::new(rx).map(|result| match result {
Ok(event) => Ok(event.into()),

View File

@@ -127,7 +127,7 @@ macro_rules! get_reparse_path {
} else {
let path_buffer = reparse_data.path_buffer.as_ptr();
let parsed_path = std::slice::from_raw_parts(
path_buffer.add((reparse_data.sub_name_offset as usize / mem::size_of::<u16>())),
path_buffer.add(reparse_data.sub_name_offset as usize / mem::size_of::<u16>()),
reparse_data.sub_name_length as usize / mem::size_of::<u16>(),
);
Ok::<PathBuf, io::Error>(PathBuf::from(OsString::from_wide(parsed_path)))

View File

@@ -70,7 +70,7 @@ pub fn create_hidden_window<F: (Fn(HWND, u32, WPARAM, LPARAM) -> LRESULT) + Send
GWLP_WNDPROC,
// Clippy does not like casting function pointers to anything but usize.
// But this is correct, since the Windows API expects a signed int for pointer.
window_procedure::<F> as usize as isize,
window_procedure::<F> as *const () as usize as isize,
);
}

View File

@@ -605,10 +605,12 @@ mod test {
#[test]
fn deserialize_netlink_message() {
assert!(
cfg!(target_endian = "little"),
"this test assumes little-endian"
);
const {
assert!(
cfg!(target_endian = "little"),
"this test assumes little-endian"
);
}
#[rustfmt::skip]
let payload = vec![
@@ -845,10 +847,12 @@ mod test {
#[test]
fn serialize_netlink_message() {
assert!(
cfg!(target_endian = "little"),
"this test assumes little-endian"
);
const {
assert!(
cfg!(target_endian = "little"),
"this test assumes little-endian"
);
}
let expected_payload: &[u8] = &[
0x01, 0x01, 0x00, 0x00, 0x0c, 0x00, 0x02, 0x00, 0x77, 0x67, 0x2d, 0x74, 0x65, 0x73,