Fix Display impl, resolving clippy

This commit is contained in:
Matthew Esposito 2024-05-29 18:51:20 -04:00
parent e13d9b7239
commit a64e2143f3

View File

@ -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;
@ -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(()),
}
}
}