Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Unit methods return &'static str where possible #393

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading