Skip to content

Commit 3255f21

Browse files
committed
Fix unexpected_cfgs lints with the latest rustc
The latest rustc attempts to detect invalid `#[cfg()]` values. But some of Mockall's tests conditionalize code on `target_os = "multics"` as an intentionally always-false condition. Suppress the lint for those files. Also, one CI test sets a custom "reprocheck" variable. Add that to the list of known variables.
1 parent 06b7bd9 commit 3255f21

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

mockall/tests/automock_attrs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// vim: tw=80
22
//! Attributes are applied to the mock object, too.
33
#![deny(warnings)]
4+
#![allow(unexpected_cfgs)] // multics is deliberately always false
45

56
use mockall::*;
67

mockall/tests/cfg_attr_concretize.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
// vim: tw=80
22
//! #[concretize] can be used inside of #[cfg_attr()]`
33
#![deny(warnings)]
4+
#![allow(unexpected_cfgs)] // multics is deliberately always false
45

56
use std::path::{Path, PathBuf};
67

78
use mockall::{automock, concretize};
89

910
#[automock]
1011
trait Foo {
11-
#[cfg_attr(not(target_os = "ia64-unknown-multics"), concretize)]
12+
#[cfg_attr(not(target_os = "multics"), concretize)]
1213
fn foo<P: AsRef<Path>>(&self, p: P);
1314
}
1415

mockall_derive/build.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
fn main() {
2+
// Avoid unnecessary re-building.
3+
println!("cargo:rerun-if-changed=build.rs");
4+
5+
// Quiet rustc's helpful lint. reprocheck is defined in CI.
6+
println!("cargo::rustc-check-cfg=cfg(reprocheck)");
7+
}

0 commit comments

Comments
 (0)