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 libflate::gzip;
use route_recognizer::{Params, Router}; use route_recognizer::{Params, Router};
use std::{ use std::{
cmp::Ordering, cmp::Ordering, fmt::Display, io, pin::Pin, result::Result, str::{from_utf8, Split}, string::ToString
io,
pin::Pin,
result::Result,
str::{from_utf8, Split},
string::ToString,
}; };
use time::Duration; use time::Duration;
@ -67,12 +62,12 @@ impl CompressionType {
} }
} }
impl ToString for CompressionType { impl Display for CompressionType {
fn to_string(&self) -> String { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self { match self {
Self::Gzip => "gzip".to_string(), Self::Gzip => write!(f, "gzip"),
Self::Brotli => "br".to_string(), Self::Brotli => write!(f, "br"),
Self::Passthrough => String::new(), Self::Passthrough => Ok(()),
} }
} }
} }