Skip to content

Commit

Permalink
Fix Display impl, resolving clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
sigaloid committed May 29, 2024
1 parent e13d9b7 commit a64e214
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ use hyper::{Body, Method, Request, Response, Server as HyperServer};
use libflate::gzip;
use route_recognizer::{Params, Router};
use std::{
cmp::Ordering,
io,
pin::Pin,
result::Result,
str::{from_utf8, Split},
string::ToString,
cmp::Ordering, fmt::Display, io, pin::Pin, result::Result, str::{from_utf8, Split}, string::ToString
};
use time::Duration;

Expand Down Expand Up @@ -67,12 +62,12 @@ impl CompressionType {
}
}

impl ToString for CompressionType {
fn to_string(&self) -> String {
impl Display for CompressionType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Gzip => "gzip".to_string(),
Self::Brotli => "br".to_string(),
Self::Passthrough => String::new(),
Self::Gzip => write!(f, "gzip"),
Self::Brotli => write!(f, "br"),
Self::Passthrough => Ok(()),
}
}
}
Expand Down

0 comments on commit a64e214

Please sign in to comment.