Skip to content

Commit 4b355d8

Browse files
committed
Auto merge of rust-lang#11154 - Alexendoo:track-clippy-conf-dir, r=flip1995
Trigger a rebuild when `CLIPPY_CONF_DIR` changes changelog: none This is a fix for rust-lang/rust-clippy#9928 (comment), any time `CLIPPY_CONF_DIR` changes cargo will now rebuild the crate clippy is being run on, giving it a chance to lint with the (potentially) different config file r? `@flip1995`
2 parents 7ccf5d4 + 36279f1 commit 4b355d8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/driver.rs

+7
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ impl rustc_driver::Callbacks for ClippyCallbacks {
130130
config.parse_sess_created = Some(Box::new(move |parse_sess| {
131131
track_clippy_args(parse_sess, &clippy_args_var);
132132
track_files(parse_sess);
133+
134+
// Trigger a rebuild if CLIPPY_CONF_DIR changes. The value must be a valid string so
135+
// changes between dirs that are invalid UTF-8 will not trigger rebuilds
136+
parse_sess.env_depinfo.get_mut().insert((
137+
Symbol::intern("CLIPPY_CONF_DIR"),
138+
env::var("CLIPPY_CONF_DIR").ok().map(|dir| Symbol::intern(&dir)),
139+
));
133140
}));
134141
config.register_lints = Some(Box::new(move |sess, lint_store| {
135142
// technically we're ~guaranteed that this is none but might as well call anything that

0 commit comments

Comments
 (0)