Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Simplify code
  • Loading branch information
Gerry Agbobada committed Apr 28, 2023
commit 78f8588c5f5c282507ac8ce88b8538fbd4557bf9
2 changes: 1 addition & 1 deletion autometrics-macros/src/result_labels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub(crate) fn expand(input: DeriveInput) -> Result<TokenStream> {

Ok(quote! {
#[automatically_derived]
impl #impl_generics ::autometrics::__private::GetResultLabelFromEnum for #enum_name #ty_generics #where_clause {
impl #impl_generics ::autometrics::__private::GetResultLabel for #enum_name #ty_generics #where_clause {
fn __autometrics_get_result_label(&self) -> &'static str {
#(#conditional_clauses_for_labels)*
#ERROR_KEY
Expand Down
9 changes: 0 additions & 9 deletions autometrics/src/labels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,12 +233,3 @@ pub trait GetResultLabel {
}
}
impl_trait_for_types!(GetResultLabel);

/// Implementation detail to get enum variants to specify their own
/// "result" label
pub trait GetResultLabelFromEnum {
/// Return the value to use for the [result](RESULT_KEY) value in the reported metrics
fn __autometrics_get_result_label(&self) -> &'static str {
ERROR_KEY
}
}
2 changes: 1 addition & 1 deletion autometrics/tests/result_labels/pass/macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! autometrics (the library) is then responsible for orchestrating the
//! calls to `__autometrics_get_error_label` correctly when observing
//! function call results for the metrics.
use autometrics::__private::GetResultLabelFromEnum;
use autometrics::__private::GetResultLabel;
use autometrics_macros::ResultLabels;

struct Inner {}
Expand Down