Cleaned up lint when building with prom or profile features.

This commit is contained in:
Bill Thiede 2019-10-13 08:04:49 -07:00
parent 38317de40d
commit 90c4e15ad1
3 changed files with 8 additions and 2 deletions

View File

@ -88,8 +88,10 @@ fn push_metrics(push_gateway_addr: &str, instance: String, start_time: &DateTime
} }
} }
#[cfg(not(feature = "profile"))]
struct MockTimer; struct MockTimer;
#[cfg(not(feature = "profile"))]
impl MockTimer { impl MockTimer {
fn start<T: Into<Vec<u8>>>(&self, _: T) -> Result<(), ()> { fn start<T: Into<Vec<u8>>>(&self, _: T) -> Result<(), ()> {
Ok(()) Ok(())
@ -99,8 +101,10 @@ impl MockTimer {
} }
} }
#[cfg(not(feature = "profile"))]
struct MockProfiler; struct MockProfiler;
#[cfg(not(feature = "profile"))]
impl MockProfiler { impl MockProfiler {
fn lock(&self) -> Option<MockTimer> { fn lock(&self) -> Option<MockTimer> {
Some(MockTimer {}) Some(MockTimer {})

View File

@ -31,7 +31,5 @@ extern crate structopt;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
#[macro_use] #[macro_use]
extern crate lazy_static;
#[macro_use]
#[cfg(feature = "prom")] #[cfg(feature = "prom")]
extern crate prometheus; extern crate prometheus;

View File

@ -15,6 +15,8 @@ use std::time;
use image; use image;
use image::RgbImage; use image::RgbImage;
#[cfg(feature = "prom")]
use lazy_static::lazy_static;
use num_cpus; use num_cpus;
use rand; use rand;
use rand::Rng; use rand::Rng;
@ -36,7 +38,9 @@ lazy_static! {
register_counter_vec!("rays", "Number of rays fired", &["level"]).unwrap(); register_counter_vec!("rays", "Number of rays fired", &["level"]).unwrap();
} }
#[cfg(not(feature = "prom"))]
struct MockPrometheus; struct MockPrometheus;
#[cfg(not(feature = "prom"))]
impl MockPrometheus { impl MockPrometheus {
fn with_label_values(&self, _: &[&str]) -> &MockPrometheus { fn with_label_values(&self, _: &[&str]) -> &MockPrometheus {
self self