Skip to content

Commit b481c5b

Browse files
committed
std_detect testing improvements
* Fix riscv testing. Previously the mod tests; would be looking for src/detect/os/tests.rs. * Replace a test with an unnamed const item. It is testing that no warnings are emitted. It doesn't contain any checks that need to run at runtime. Replacing the test allows removing the tidy:skip directive for test locations.
1 parent c5d7021 commit b481c5b

File tree

3 files changed

+4
-5
lines changed

3 files changed

+4
-5
lines changed

library/std_detect/src/detect/macros.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,13 @@ macro_rules! features {
131131
};
132132
}
133133

134-
#[test] //tidy:skip
135134
#[deny(unexpected_cfgs)]
136135
#[deny(unfulfilled_lint_expectations)]
137-
fn unexpected_cfgs() {
136+
const _: () = {
138137
$(
139138
check_cfg_feature!($feature, $feature_lit $(, without cfg check: $feature_cfg_check)? $(: $($target_feature_lit),*)?);
140139
)*
141-
}
140+
};
142141

143142
/// Each variant denotes a position in a bitset for a particular feature.
144143
///

library/std_detect/src/detect/os/riscv.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,4 +135,5 @@ pub(crate) fn imply_features(mut value: cache::Initializer) -> cache::Initialize
135135
}
136136

137137
#[cfg(test)]
138+
#[path = "riscv/tests.rs"]
138139
mod tests;

src/tools/tidy/src/unit_tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ pub fn check(root_path: &Path, stdlib: bool, bad: &mut bool) {
7979
let line = line.trim();
8080
let is_test = || line.contains("#[test]") && !line.contains("`#[test]");
8181
let is_bench = || line.contains("#[bench]") && !line.contains("`#[bench]");
82-
let manual_skip = line.contains("//tidy:skip");
83-
if !line.starts_with("//") && (is_test() || is_bench()) && !manual_skip {
82+
if !line.starts_with("//") && (is_test() || is_bench()) {
8483
let explanation = if stdlib {
8584
format!(
8685
"`{package}` unit tests and benchmarks must be placed into `{package}tests`"

0 commit comments

Comments
 (0)