KEMBAR78
Prefer `expect` to `allow` for Rust and Clippy lints by kennykerr · Pull Request #3716 · microsoft/windows-rs · GitHub
Skip to content

Conversation

@kennykerr
Copy link
Collaborator

@kennykerr kennykerr commented Aug 13, 2025

The benefit of expect is that it warns if the lint is not actually triggered and thus helps to identify outdated or misapplied lints.

I continue to use allow for macros and generated bindings.

Unfortunately, the expect attribute is new to Rust 1.81 so I have updated the MSRV for most crates as they are due for breaking change updates with the exception of windows-version which I will leave as is to avoid bumping the MSRV.

@kennykerr
Copy link
Collaborator Author

kennykerr commented Aug 13, 2025

The docs aren't clean on what version of Rust stabilized expect but evidently it is after the MSRV for the windows crate...

Looks like it is 1.81


module = LoadLibraryExA(
b"ntdll.dll\0".as_ptr(),
c"ntdll.dll".as_ptr() as _,
Copy link
Collaborator Author

@kennykerr kennykerr Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a false positive as Clippy insists I use c"..." but that fails to compile since the result is a signed pointer whereas LoadLibraryExA expects an unsigned pointer...

I also don't see how this is better 🙃

@kennykerr kennykerr merged commit 8b027ad into master Aug 13, 2025
29 checks passed
@kennykerr kennykerr deleted the expect branch August 13, 2025 20:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant