diff options
author | Martin Robinson <mrobinson@igalia.com> | 2024-07-04 16:18:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-07-04 14:18:58 +0000 |
commit | 4b63043c6ae9ca9d51c6139101e294aaef379702 (patch) | |
tree | e88cdf1f58308a55dde90ab1d73f72752dcc0fa7 /components/shared/net/lib.rs | |
parent | 99c1f886b8398e73e5af06135f6f357752e2cb16 (diff) | |
download | servo-4b63043c6ae9ca9d51c6139101e294aaef379702.tar.gz servo-4b63043c6ae9ca9d51c6139101e294aaef379702.zip |
clippy: Fix warnings in `shared` and `config`, `fonts`, `layout`, and `layout_2020` components (#32674)
Diffstat (limited to 'components/shared/net/lib.rs')
-rw-r--r-- | components/shared/net/lib.rs | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/components/shared/net/lib.rs b/components/shared/net/lib.rs index 1fccc8a18c4..db3519f30ad 100644 --- a/components/shared/net/lib.rs +++ b/components/shared/net/lib.rs @@ -4,6 +4,7 @@ #![deny(unsafe_code)] +use std::fmt::Display; use std::time::{SystemTime, UNIX_EPOCH}; use base::id::HistoryStateId; @@ -118,9 +119,9 @@ pub enum ReferrerPolicy { StrictOriginWhenCrossOrigin, } -impl ToString for ReferrerPolicy { - fn to_string(&self) -> String { - match self { +impl Display for ReferrerPolicy { + fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let string = match self { ReferrerPolicy::NoReferrer => "no-referrer", ReferrerPolicy::NoReferrerWhenDowngrade => "no-referrer-when-downgrade", ReferrerPolicy::Origin => "origin", @@ -129,8 +130,8 @@ impl ToString for ReferrerPolicy { ReferrerPolicy::UnsafeUrl => "unsafe-url", ReferrerPolicy::StrictOrigin => "strict-origin", ReferrerPolicy::StrictOriginWhenCrossOrigin => "strict-origin-when-cross-origin", - } - .to_string() + }; + write!(formatter, "{string}") } } |