Skip to content

Commit

Permalink
Make Unit methods return &'static str where possible (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
david-perez authored Sep 22, 2023
1 parent d788aae commit 67d5100
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions metrics/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ pub enum Unit {

impl Unit {
/// Gets the string form of this `Unit`.
pub fn as_str(&self) -> &str {
pub fn as_str(&self) -> &'static str {
match self {
Unit::Count => "count",
Unit::Percent => "percent",
Expand Down Expand Up @@ -149,7 +149,7 @@ impl Unit {
/// it would be `ns`.
///
/// Not all units have a meaningful display label and so some may be empty.
pub fn as_canonical_label(&self) -> &str {
pub fn as_canonical_label(&self) -> &'static str {
match self {
Unit::Count => "",
Unit::Percent => "%",
Expand Down

0 comments on commit 67d5100

Please sign in to comment.