Skip to content

Commit

Permalink
clean up code and add default implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
grtn316 committed Jun 19, 2024
1 parent 4ed533d commit 15f49e6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions clippy_utils/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ impl EmissionState {
}
}

impl Default for EmissionState {
fn default() -> Self {
Self::new()
}
}

lazy_static! {
pub static ref GLOBAL_EMISSION_STATE: EmissionState = EmissionState::new();
}
Expand Down Expand Up @@ -127,7 +133,9 @@ pub fn get_attr<'a>(
false
},
|deprecation_status| {
if !GLOBAL_EMISSION_STATE.has_emitted(&attr_name) {
if GLOBAL_EMISSION_STATE.has_emitted(&attr_name) {
false
} else {
let mut diag = sess
.dcx()
.struct_span_err(attr_segments[1].ident.span, "usage of deprecated attribute");
Expand Down Expand Up @@ -158,8 +166,6 @@ pub fn get_attr<'a>(
attr_segments[1].ident.name.as_str() == name
},
}
} else {
false
}
},
)
Expand Down

0 comments on commit 15f49e6

Please sign in to comment.