Add sanity Drop impl.

This commit is contained in:
Camille GILLOT 2022-10-01 09:49:52 +02:00
parent 299e10d7ad
commit fec53fd9db

View file

@ -494,6 +494,14 @@ impl<'s> LintLevelsBuilder<'s, TopDown> {
/// Called after `push` when the scope of a set of attributes are exited.
pub(crate) fn pop(&mut self, push: BuilderPush) {
self.provider.cur = push.prev;
std::mem::forget(push);
}
}
#[cfg(debug_assertions)]
impl Drop for BuilderPush {
fn drop(&mut self) {
panic!("Found a `push` without a `pop`.");
}
}