Repository navigation
style: Move font-language-override outside of mako - #19188
Conversation
|
Heads up! This PR modifies the following files:
|
| FontLanguageOverride::Override(ref lang) => lang.to_css(dest), | ||
| FontLanguageOverride::System(sys) => sys.to_css(dest), | ||
| } | ||
| } |
There was a problem hiding this comment.
After checking #19186 , I think I can remove this impl and derive ToCss instead?
There was a problem hiding this comment.
Indeed this can just be derived, mind doing that? Thanks! :)
There was a problem hiding this comment.
Sure, I'll change it to use derive in the late today :)
| impl FontLanguageOverride { | ||
| #[inline] | ||
| /// Get computed default value of `font-language-override` with 0 | ||
| pub fn get_initial_value() -> FontLanguageOverride { |
There was a problem hiding this comment.
Let's call this fn zero(), and use that instead.
| if input.try(|input| input.expect_ident_matching("normal")).is_ok() { | ||
| Ok(FontLanguageOverride::Normal) | ||
| } else { | ||
| input.expect_string().map(|s| { |
There was a problem hiding this comment.
This can just be:
let string = input.expect_string()?;
Ok(FontLanguageOverride::Override(string.to_owned()))| /// normal | <string> | ||
| fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<FontLanguageOverride, ParseError<'i>> { | ||
| if input.try(|input| input.expect_ident_matching("normal")).is_ok() { | ||
| Ok(FontLanguageOverride::Normal) |
There was a problem hiding this comment.
Let's add a return here:
return Ok(FontLanguageOverride::Normal)And remove the } else { below.
| FontLanguageOverride::Override(ref lang) => lang.to_css(dest), | ||
| FontLanguageOverride::System(sys) => sys.to_css(dest), | ||
| } | ||
| } |
There was a problem hiding this comment.
Indeed this can just be derived, mind doing that? Thanks! :)
| /// Single three-letter case-sensitive OpenType language system tag, | ||
| /// specifies the OpenType language system to be used instead of | ||
| /// the language system implied by the language of the element | ||
| Override(String), |
There was a problem hiding this comment.
If you feel like it, you can use Box<str> to save some memory (using into_boxed_string) during parsing.
There was a problem hiding this comment.
Thanks! I'll try it! I'd like to try Box<str>!
59467c1 to
efebd1c
Compare
|
@bors-servo r+ |
|
📌 Commit efebd1c has been approved by |
…ilio style: Move font-language-override outside of mako This is a sub-PR of #19015 r? emilio --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #19187 - [x] These changes do not require tests <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19188) <!-- Reviewable:end -->
|
💔 Test failed - linux-dev |
efebd1c to
38eae70
Compare
|
@bors-servo r+ |
|
📌 Commit 38eae70 has been approved by |
…ilio style: Move font-language-override outside of mako This is a sub-PR of #19015 r? emilio --- - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors - [x] These changes fix #19187 - [x] These changes do not require tests <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/19188) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
This is a sub-PR of #19015
r? emilio
./mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is