diff --git a/src/server.rs b/src/server.rs index 020f780..c37d5f0 100644 --- a/src/server.rs +++ b/src/server.rs @@ -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(()), } } }