Skip to content

Commit 05a77e1

Browse files
committed
fix: tests & clippy
1 parent a845276 commit 05a77e1

8 files changed

Lines changed: 9 additions & 14 deletions

File tree

src/args.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ impl Default for CliArgs {
2626
}
2727

2828
impl CliArgs {
29-
/// Thin wrapper over [`Self::from_iter`].
29+
/// Thin wrapper over [`Self::from_args`].
3030
pub fn from_env() -> Result<Self> {
3131
Self::from_args(std::env::args())
3232
}

src/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Collector for metrics.
2+
#![allow(clippy::new_without_default)]
23

3-
use std::cell::RefCell;
44
use std::sync::Arc;
55

66
use anyhow::Result;

src/http.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use smol_hyper::rt::{FuturesIo, SmolTimer};
1010
use crate::collector::Collector;
1111
use crate::http_utils::{internal_server_error, not_found};
1212

13-
async fn serve_metrics(collector: &Collector) -> Result<Response<BoxBody<Bytes, hyper::Error>>> {
13+
async fn serve_metrics(_collector: &Collector) -> Result<Response<BoxBody<Bytes, hyper::Error>>> {
1414
Err(anyhow::anyhow!("no"))
1515
}
1616

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn main() {
1919
/// Real, asynchronous entrypoint.
2020
async fn async_main(_ex: &Rc<smol::LocalExecutor<'_>>) {
2121
let args = CliArgs::from_env().expect("invalid args");
22-
let config = UserConfig::from_path(&args.config_path)
22+
let _config = UserConfig::from_path(&args.config_path)
2323
.await
2424
.expect("invalid config");
2525

src/metrics/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ impl Metric for SystemdUnitStateCollector {
361361

362362
if let Some(client) = self.systemd_client.lock().await.as_ref() {
363363
for unit_name in &*units {
364-
match client.active_state(&unit_name).await {
364+
match client.active_state(unit_name).await {
365365
Ok(state) => {
366366
for state_name in ActiveState::all_states() {
367367
let labels = SystemdUnitLabels {

src/metrics/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ impl FilesystemUsage {
4343
///
4444
/// # Example
4545
///
46-
/// ```
46+
/// ```ignore,no_run
4747
/// use litemon::metrics::fs::FilesystemUsage;
4848
///
4949
/// fn main() -> anyhow::Result<()> {

src/metrics/memory.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,7 @@
11
//! Memory metrics collection.
22
3-
use std::sync::atomic::AtomicU64;
4-
53
use anyhow::{Context, Result};
64
use procfs::Current;
7-
use prometheus_client::metrics::gauge::Gauge;
8-
9-
use super::{DynFuture, Metric};
105

116
/// Returns the percentage of memory currently used on the system.
127
///

tests/integration/cliargs.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ use litemon::args::CliArgs;
66

77
#[test]
88
fn parse_args_default() {
9-
let args = CliArgs::from_iter(["litemon"]).unwrap();
9+
let args = CliArgs::from_args(["litemon"]).unwrap();
1010
assert_eq!(args, CliArgs::default());
1111
}
1212

1313
#[test]
1414
fn parse_args_short() {
15-
let args = CliArgs::from_iter([
15+
let args = CliArgs::from_args([
1616
"litemon",
1717
"-n",
1818
"localhost",
@@ -33,7 +33,7 @@ fn parse_args_short() {
3333

3434
#[test]
3535
fn parse_args_long() {
36-
let args = CliArgs::from_iter([
36+
let args = CliArgs::from_args([
3737
"litemon",
3838
"--listen",
3939
"localhost",

0 commit comments

Comments
 (0)