Remove potential cfgs duplicates

This commit is contained in:
Guillaume Gomez 2019-12-03 18:07:00 +01:00
parent 8f1bbd69e1
commit a8ec6200df
2 changed files with 21 additions and 0 deletions

View File

@ -209,6 +209,9 @@ fn not(self) -> Cfg {
impl ops::BitAndAssign for Cfg {
fn bitand_assign(&mut self, other: Cfg) {
if *self == other {
return;
}
match (self, other) {
(&mut Cfg::False, _) | (_, Cfg::True) => {},
(s, Cfg::False) => *s = Cfg::False,
@ -238,6 +241,9 @@ fn bitand(mut self, other: Cfg) -> Cfg {
impl ops::BitOrAssign for Cfg {
fn bitor_assign(&mut self, other: Cfg) {
if *self == other {
return;
}
match (self, other) {
(&mut Cfg::True, _) | (_, Cfg::False) => {},
(s, Cfg::True) => *s = Cfg::True,

View File

@ -0,0 +1,15 @@
#![crate_name = "foo"]
#![feature(doc_cfg)]
// @has 'foo/index.html'
// @!has '-' '//*[@class="stab portability"]' 'feature="sync" and'
// @has '-' '//*[@class="stab portability"]' 'feature="sync"'
#[doc(cfg(feature = "sync"))]
#[doc(cfg(feature = "sync"))]
pub struct Foo;
#[doc(cfg(feature = "sync"))]
pub mod bar {
#[doc(cfg(feature = "sync"))]
pub struct Bar;
}