Skip to content

Commit

Permalink
permit trailing commans in describe macros (#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperFluffy authored May 9, 2024
1 parent deba76a commit ce9084b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions metrics/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ macro_rules! histogram {
#[doc(hidden)]
#[macro_export]
macro_rules! describe {
($method:ident, $name:expr, $unit:expr, $description:expr) => {{
($method:ident, $name:expr, $unit:expr, $description:expr $(,)?) => {{
$crate::with_recorder(|recorder| {
recorder.$method(
::core::convert::Into::into($name),
Expand All @@ -265,7 +265,7 @@ macro_rules! describe {
);
});
}};
($method:ident, $name:expr, $description:expr) => {{
($method:ident, $name:expr, $description:expr $(,)?) => {{
$crate::with_recorder(|recorder| {
recorder.$method(
::core::convert::Into::into($name),
Expand Down Expand Up @@ -314,10 +314,10 @@ macro_rules! describe {
/// ```
#[macro_export]
macro_rules! describe_counter {
($name:expr, $unit:expr, $description:expr) => {
($name:expr, $unit:expr, $description:expr $(,)?) => {
$crate::describe!(describe_counter, $name, $unit, $description)
};
($name:expr, $description:expr) => {
($name:expr, $description:expr $(,)?) => {
$crate::describe!(describe_counter, $name, $description)
};
}
Expand Down Expand Up @@ -360,10 +360,10 @@ macro_rules! describe_counter {
/// ```
#[macro_export]
macro_rules! describe_gauge {
($name:expr, $unit:expr, $description:expr) => {
($name:expr, $unit:expr, $description:expr $(,)?) => {
$crate::describe!(describe_gauge, $name, $unit, $description)
};
($name:expr, $description:expr) => {
($name:expr, $description:expr $(,)?) => {
$crate::describe!(describe_gauge, $name, $description)
};
}
Expand Down Expand Up @@ -406,10 +406,10 @@ macro_rules! describe_gauge {
/// ```
#[macro_export]
macro_rules! describe_histogram {
($name:expr, $unit:expr, $description:expr) => {
($name:expr, $unit:expr, $description:expr $(,)?) => {
$crate::describe!(describe_histogram, $name, $unit, $description)
};
($name:expr, $description:expr) => {
($name:expr, $description:expr $(,)?) => {
$crate::describe!(describe_histogram, $name, $description)
};
}

0 comments on commit ce9084b

Please sign in to comment.