From 5277275263b7d8f69eb0e0a3476fa2ff017dec36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 3 Dec 2020 19:37:05 +0000 Subject: [PATCH] style: Make CssUrl::is_fragment marginally more efficient. No need to do utf8 shenanigans for what this function does. Differential Revision: https://phabricator.services.mozilla.com/D97473 --- components/style/gecko/url.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/style/gecko/url.rs b/components/style/gecko/url.rs index 2e694b3a2d6..ac7c9359b00 100644 --- a/components/style/gecko/url.rs +++ b/components/style/gecko/url.rs @@ -109,7 +109,7 @@ impl CssUrlData { /// Returns true if this URL looks like a fragment. /// See https://drafts.csswg.org/css-values/#local-urls pub fn is_fragment(&self) -> bool { - self.as_str().chars().next().map_or(false, |c| c == '#') + self.as_str().as_bytes().iter().next().map_or(false, |b| *b == b'#') } /// Return the unresolved url as string, or the empty string if it's