Repository navigation
lint: deny glob imports in the Rust workspace (#1873) - #1956
Merged
Merged
Conversation
Turns on clippy::wildcard_imports and clippy::enum_glob_use as deny in [workspace.lints.clippy] and opts every member crate in. Clippy now fails on the remaining glob imports; the next commit fixes them.
…EN, #1873) Clippy's defaults leave integration test crates, #[cfg(test)] modules, preludes and pub use re-exports alone, so only six non-test `use super::*` sites fail: four on Linux (fixed by clippy --fix) and the Windows and macOS shims modules, written out by hand.
write_out and os_proc_memory_usage are cfg(not(target_os = "macos")) in platform_nix.rs; the shims-level import broke the macOS build. Clippy is clean for aarch64-apple-darwin and x86_64-pc-windows-msvc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1873.
[workspace.lints.clippy] wildcard_imports = "deny",enum_glob_use = "deny", and[lints] workspace = truein everyrust/*crate. Localsoldr cargo clippy --workspace --all-targets --locked -- -D warningsfails:error: usage of wildcard importatrust/obs-util/src/platform/unix/nix.rs:687and three more sites in obs-util and obs-media-io.clippy --fix). Themod shimsblocks inffi/platform_windows.rsandffi/platform_cocoa.rsonly compile on Windows and macOS, so I wrote their imports by hand: each lists exactly the parent names used in its body. Windows and macOS CI checks them. Clippy and./lintpass on Linux.The issue estimated 35 to 40 sites. Clippy's built-in exemptions cover most of them: integration test crates (
tests/),#[cfg(test)]modules,*::prelude::*andpub usere-exports. So no#[expect]opt-outs are needed yet. The platform facade re-exports and the$api::*parity macro stay as they are.Tiers: lint/config only. Tiers 1 to 4 do not apply, and there is no behavior change. No features.md entry, since nothing changes for users.