Skip to content

Commit 2cca036

Browse files
committed
fix: clippy issues as of 1.79.0
1 parent 560f58f commit 2cca036

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

src/addon/file_server/http_utils.rs

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1+
use std::fmt::Display;
2+
use std::mem::MaybeUninit;
3+
use std::pin::Pin;
4+
use std::task::{self, Poll};
5+
16
use anyhow::{Context, Result};
27
use chrono::{DateTime, Local, Utc};
38
use futures::Stream;
49
use http::response::Builder as HttpResponseBuilder;
510
use hyper::body::Body;
611
use hyper::body::Bytes;
7-
use std::mem::MaybeUninit;
8-
use std::pin::Pin;
9-
use std::task::{self, Poll};
1012
use tokio::io::{AsyncRead, ReadBuf};
1113

1214
use super::file::File;
@@ -41,9 +43,9 @@ pub enum CacheControlDirective {
4143
SMaxAge(u64),
4244
}
4345

44-
impl ToString for CacheControlDirective {
45-
fn to_string(&self) -> String {
46-
match &self {
46+
impl Display for CacheControlDirective {
47+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
48+
let string = match &self {
4749
Self::MustRevalidate => String::from("must-revalidate"),
4850
Self::NoCache => String::from("no-cache"),
4951
Self::NoStore => String::from("no-store"),
@@ -53,7 +55,9 @@ impl ToString for CacheControlDirective {
5355
Self::ProxyRavalidate => String::from("proxy-revalidate"),
5456
Self::MaxAge(age) => format!("max-age={}", age),
5557
Self::SMaxAge(age) => format!("s-maxage={}", age),
56-
}
58+
};
59+
60+
write!(f, "{string}")
5761
}
5862
}
5963

0 commit comments

Comments
 (0)