chore: clippy disallows std::env access outside the config module - #217
Draft
ecalifornica wants to merge 1 commit into
Draft
chore: clippy disallows std::env access outside the config module#217ecalifornica wants to merge 1 commit into
ecalifornica wants to merge 1 commit into
Conversation
ecalifornica
force-pushed
the
robert/config-env-lint
branch
from
August 14, 2026 19:49
9b1b2d8 to
d4b9959
Compare
|
🔍 Preview deployed: https://c1ec4150.toolpath.pages.dev |
clippy.toml adds a disallowed-methods rule for std::env::var, var_os, vars, vars_os, set_var, and remove_var. Readers must take the value as a parameter. Tests construct values instead of mutating the environment. The clippy quality gate runs with --all-targets, so the rule covers unit tests, integration tests, examples, and build scripts. Five sites carry an #[expect] with a reason: - crates/path-cli/src/config.rs search_path: the config module is the one place that reads the environment. - crates/path-cli/src/fuzzy.rs which: the fzf probe keeps its own read until the search path's owner is decided in review. - crates/pathbase-client/build.rs: cargo passes OUT_DIR to a build script only through the environment. - crates/toolpath-cursor/examples/dump_fixture.rs and crates/toolpath-cursor/tests/real_session_sanity.rs: both read the developer's real Cursor store, so both must locate the real home directory.
ecalifornica
force-pushed
the
robert/config-env-lint
branch
from
August 18, 2026 20:10
d4b9959 to
52e0466
Compare
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.
Part of #187; with the two PRs below it, closes #187. No user-visible changes.
What
clippy.tomladds adisallowed-methodsrule forstd::env::var,var_os,vars,vars_os,set_var, andremove_var. Readers take the value as a parameter; tests construct values instead of mutating the environment.scripts/quality_gates.sh, the gate CI runs) adds--all-targets, so the rule covers unit tests, integration tests, examples, and build scripts. Without it, clippy skips test and example code, which is where the env-mutating machinery lived.#[expect(clippy::disallowed_methods)]with a reason:path-cliconfig::search_path: the config module is the one place that reads the environment.path-clifuzzy::which: the fzf probe keeps its own read until the search-path question on the bottom PR of this stack is decided. A follow-up PR removes this exception.pathbase-client/build.rs: cargo passesOUT_DIRto a build script only through the environment.toolpath-cursor'sdump_fixtureexample andreal_session_sanitytest: both read the developer's real Cursor store on purpose.#[expect]rather than#[allow]: an exception that stops firing becomes a warning itself, so stale exceptions fail the gate.Verified
std::env::varcall in src code and in#[cfg(test)]code each fail the gate with the configured reason. The test-code probe passes without--all-targets, so the gate change is load-bearing.cargo clippy --workspace --all-targets -- -D warningsis clean on this branch. A stale build cache can mask a newclippy.tomllocally;cargo clean -p <crate>refreshes it. Fresh CI checkouts are unaffected.