Skip to content

Commit

Permalink
*: Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mxinden committed Nov 19, 2022
1 parent 93819ed commit e8ea704
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
5 changes: 2 additions & 3 deletions src/encoding.rs
Expand Up @@ -299,7 +299,6 @@ enum LabelValueEncoderInner<'a> {

impl<'a> LabelValueEncoder<'a> {
/// Finish encoding the label value.
#[must_use]
pub fn finish(self) -> Result<(), std::fmt::Error> {
for_both!(self, LabelValueEncoderInner, e, e.finish())
}
Expand Down Expand Up @@ -394,13 +393,13 @@ impl<'a> EncodeLabelValue for Cow<'a, str> {
}
}

impl<'a> EncodeLabelValue for f64 {
impl EncodeLabelValue for f64 {
fn encode(&self, encoder: &mut LabelValueEncoder) -> Result<(), std::fmt::Error> {
encoder.write_str(dtoa::Buffer::new().format(*self))
}
}

impl<'a> EncodeLabelValue for u64 {
impl EncodeLabelValue for u64 {
fn encode(&self, encoder: &mut LabelValueEncoder) -> Result<(), std::fmt::Error> {
encoder.write_str(itoa::Buffer::new().format(*self))
}
Expand Down
2 changes: 1 addition & 1 deletion src/encoding/text.rs
Expand Up @@ -209,7 +209,7 @@ impl<'a, 'b> MetricEncoder<'a, 'b> {
self.newline()?;

let mut cummulative = 0;
for (i, (upper_bound, count)) in buckets.into_iter().enumerate() {
for (i, (upper_bound, count)) in buckets.iter().enumerate() {
cummulative += count;

self.write_name_and_unit()?;
Expand Down
13 changes: 1 addition & 12 deletions src/registry.rs
Expand Up @@ -54,25 +54,14 @@ use std::borrow::Cow;
/// # "# EOF\n";
/// # assert_eq!(expected, buffer);
/// ```
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct Registry {
prefix: Option<Prefix>,
labels: Vec<(Cow<'static, str>, Cow<'static, str>)>,
metrics: Vec<(Descriptor, Box<dyn Metric>)>,
sub_registries: Vec<Registry>,
}

impl Default for Registry {
fn default() -> Self {
Self {
prefix: None,
labels: Default::default(),
metrics: Default::default(),
sub_registries: vec![],
}
}
}

impl Registry {
/// Creates a new default [`Registry`] with the given prefix.
pub fn with_prefix(prefix: impl Into<String>) -> Self {
Expand Down

0 comments on commit e8ea704

Please sign in to comment.