summaryrefslogtreecommitdiff
path: root/clippy_utils/src/consts.rs
diff options
context:
space:
mode:
Diffstat (limited to 'clippy_utils/src/consts.rs')
-rw-r--r--clippy_utils/src/consts.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/clippy_utils/src/consts.rs b/clippy_utils/src/consts.rs
index 04347672e0f..1cf8f9721b5 100644
--- a/clippy_utils/src/consts.rs
+++ b/clippy_utils/src/consts.rs
@@ -168,6 +168,14 @@ impl Constant {
None
}
}
+
+ #[must_use]
+ pub fn peel_refs(mut self) -> Self {
+ while let Constant::Ref(r) = self {
+ self = *r;
+ }
+ self
+ }
}
/// Parses a `LitKind` to a `Constant`.