Skip to content

lint: deny glob imports in the Rust workspace (#1873) - #1956

Merged
zackees merged 3 commits into
masterfrom
infra/1873-glob-imports
Oct 23, 2026
Merged

zackees merged 3 commits into
masterfrom
infra/1873-glob-imports

Conversation

@zackees

@zackees zackees commented Oct 23, 2026

Copy link
Copy Markdown
Member

Fixes #1873.

  • RED 8f396dd: [workspace.lints.clippy] wildcard_imports = "deny", enum_glob_use = "deny", and [lints] workspace = true in every rust/* crate. Local soldr cargo clippy --workspace --all-targets --locked -- -D warnings fails: error: usage of wildcard import at rust/obs-util/src/platform/unix/nix.rs:687 and three more sites in obs-util and obs-media-io.
  • GREEN: explicit imports at those sites (from clippy --fix). The mod shims blocks in ffi/platform_windows.rs and ffi/platform_cocoa.rs only 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 ./lint pass 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::* and pub use re-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.

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.
@zackees
zackees added this pull request to the merge queue Oct 23, 2026
Merged via the queue into master with commit 32c9490 Oct 23, 2026
33 checks passed
@zackees
zackees deleted the infra/1873-glob-imports branch October 26, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

lint: ban glob imports (clippy::wildcard_imports) with explicit opt-out

1 participant