Skip to content

Commit 06e2527

Browse files
Remove is_build_script check for misleading_cfg_in_build_script rustc lint
1 parent 7385084 commit 06e2527

1 file changed

Lines changed: 1 addition & 10 deletions

File tree

compiler/rustc_lint/src/misleading_cfg_in_build_script.rs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ declare_lint! {
1919
///
2020
/// ### Example
2121
///
22-
/// ```rust,ignore (can only be run in cargo build scripts)
22+
/// ```rust,ignore (should only be run in cargo build scripts)
2323
/// if cfg!(windows) {}
2424
/// ```
2525
///
@@ -199,19 +199,10 @@ fn get_invalid_cfg_attrs(attr: &MetaItem, spans: &mut Vec<Span>, has_unknown: &m
199199
}
200200
}
201201

202-
fn is_build_script(cx: &EarlyContext<'_>) -> bool {
203-
rustc_session::utils::was_invoked_from_cargo()
204-
&& cx.sess().opts.crate_name.as_deref() == Some("build_script_build")
205-
}
206-
207202
const ERROR_MESSAGE: &str = "target-based cfg should be avoided in build scripts";
208203

209204
impl EarlyLintPass for MisleadingCfgInBuildScript {
210205
fn check_attribute(&mut self, cx: &EarlyContext<'_>, attr: &Attribute) {
211-
if !is_build_script(cx) {
212-
return;
213-
}
214-
215206
let mut spans = Vec::new();
216207
let mut has_unknown = false;
217208
match attr.name() {

0 commit comments

Comments
 (0)