Update rustfmt to the 2024 style edition (#35764)

* Use 2024 style edition

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Reformat all code

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

---------

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
Simon Wülker 2025-03-03 12:26:53 +01:00 committed by GitHub
parent 6300e820b4
commit 3d320fa96a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
603 changed files with 1739 additions and 1648 deletions

View file

@ -2,9 +2,9 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use base::Epoch;
use base::cross_process_instant::CrossProcessInstant;
use base::id::TEST_PIPELINE_ID;
use base::Epoch;
use ipc_channel::ipc;
use metrics::{PaintTimeMetrics, ProfilerMetadataFactory, ProgressiveWebMetric};
use profile_traits::time::{ProfilerChan, TimerMetadata};

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use script::test::{normalize_value, ByteString};
use script::test::{ByteString, normalize_value};
#[test]
fn test_normalize_empty_bytestring() {

View file

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use script::test::srcset::{parse_a_srcset_attribute, Descriptor, ImageSource};
use script::test::srcset::{Descriptor, ImageSource, parse_a_srcset_attribute};
#[test]
fn no_value() {

View file

@ -8,11 +8,11 @@
// except according to those terms.
use keyboard_types::{Key, Modifiers};
use script::test::DOMString;
use script::test::textinput::{
ClipboardProvider, Direction, Lines, Selection, SelectionDirection, TextInput, TextPoint,
UTF16CodeUnits, UTF8Bytes,
UTF8Bytes, UTF16CodeUnits,
};
use script::test::DOMString;
pub struct DummyClipboardContext {
content: String,
@ -104,8 +104,8 @@ fn test_textinput_when_inserting_multiple_lines_still_respects_max_length() {
}
#[test]
fn test_textinput_when_content_is_already_longer_than_max_length_and_theres_no_selection_dont_insert_anything(
) {
fn test_textinput_when_content_is_already_longer_than_max_length_and_theres_no_selection_dont_insert_anything()
{
let mut textinput = TextInput::new(
Lines::Single,
DOMString::from("abc"),
@ -121,8 +121,8 @@ fn test_textinput_when_content_is_already_longer_than_max_length_and_theres_no_s
}
#[test]
fn test_multi_line_textinput_with_maxlength_doesnt_allow_appending_characters_when_input_spans_lines(
) {
fn test_multi_line_textinput_with_maxlength_doesnt_allow_appending_characters_when_input_spans_lines()
{
let mut textinput = TextInput::new(
Lines::Multiple,
DOMString::from("abc\nd"),
@ -138,8 +138,8 @@ fn test_multi_line_textinput_with_maxlength_doesnt_allow_appending_characters_wh
}
#[test]
fn test_single_line_textinput_with_max_length_doesnt_allow_appending_characters_when_replacing_a_selection(
) {
fn test_single_line_textinput_with_max_length_doesnt_allow_appending_characters_when_replacing_a_selection()
{
let mut textinput = TextInput::new(
Lines::Single,
DOMString::from("abcde"),
@ -238,8 +238,8 @@ fn test_single_line_textinput_with_max_length_inside_char() {
}
#[test]
fn test_single_line_textinput_with_max_length_doesnt_allow_appending_characters_after_max_length_is_reached(
) {
fn test_single_line_textinput_with_max_length_doesnt_allow_appending_characters_after_max_length_is_reached()
{
let mut textinput = TextInput::new(
Lines::Single,
DOMString::from("a"),

View file

@ -3,8 +3,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use style::color::{AbsoluteColor, ColorSpace};
use style::properties::style_structs::Font;
use style::properties::ComputedValues;
use style::properties::style_structs::Font;
use style::values::animated::{Animate, Context, Procedure, ToAnimatedValue};
fn interpolate_color(from: AbsoluteColor, to: AbsoluteColor, progress: f64) -> AbsoluteColor {

View file

@ -3,7 +3,7 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use app_units::Au;
use style::attr::{parse_length, AttrValue, LengthOrPercentageOrAuto};
use style::attr::{AttrValue, LengthOrPercentageOrAuto, parse_length};
#[test]
fn test_parse_double() {

View file

@ -19,9 +19,9 @@ use style::queries::values::PrefersColorScheme;
use style::rule_cache::RuleCacheConditions;
use style::rule_tree::CascadeLevel;
use style::servo::media_queries::FontMetricsProvider;
use style::stylesheets::UrlExtraData;
use style::stylesheets::container_rule::ContainerSizeQuery;
use style::stylesheets::layer_rule::LayerOrder;
use style::stylesheets::UrlExtraData;
use style::stylist::Stylist;
use style::values::computed::font::GenericFontFamily;
use style::values::computed::{Context, Length};

View file

@ -110,8 +110,7 @@ fn background_shorthand_should_parse_when_some_fields_set() {
#[test]
fn background_shorthand_should_parse_comma_separated_declarations() {
let input =
"url(\"http://servo/test.png\") top left no-repeat, url(\"http://servo/test.png\") \
let input = "url(\"http://servo/test.png\") top left no-repeat, url(\"http://servo/test.png\") \
center / 100% 100% no-repeat, white";
let result = parse(background::parse_value, input).unwrap();

View file

@ -3,12 +3,12 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
use style::parser::Parse;
use style::properties::MaybeBoxed;
use style::properties::longhands::{
border_image_outset, border_image_repeat, border_image_slice, border_image_source,
border_image_width,
};
use style::properties::shorthands::border_image;
use style::properties::MaybeBoxed;
use style::values::specified::BorderRadius;
use style_traits::ToCss;

View file

@ -9,8 +9,8 @@ use crate::parsing::parse;
#[test]
fn negative_letter_spacing_should_parse_properly() {
use style::properties::longhands::letter_spacing;
use style::values::specified::length::{FontRelativeLength, LengthPercentage, NoCalcLength};
use style::values::specified::LetterSpacing;
use style::values::specified::length::{FontRelativeLength, LengthPercentage, NoCalcLength};
let negative_value = parse_longhand!(letter_spacing, "-0.5em");
let expected = LetterSpacing(Spacing::Value(LengthPercentage::Length(
@ -22,8 +22,8 @@ fn negative_letter_spacing_should_parse_properly() {
#[test]
fn negative_word_spacing_should_parse_properly() {
use style::properties::longhands::word_spacing;
use style::values::specified::length::{FontRelativeLength, LengthPercentage, NoCalcLength};
use style::values::specified::WordSpacing;
use style::values::specified::length::{FontRelativeLength, LengthPercentage, NoCalcLength};
let negative_value = parse_longhand!(word_spacing, "-0.5em");
let expected = WordSpacing(Spacing::Value(LengthPercentage::Length(

View file

@ -23,21 +23,27 @@ fn test_cubic_bezier() {
);
// p1x and p2x values must be in range [0, 1]
assert!(parse(
transition_timing_function::parse,
"cubic-bezier(-1, 0, 0, 0"
)
.is_err());
assert!(parse(
transition_timing_function::parse,
"cubic-bezier(0, 0, -1, 0"
)
.is_err());
assert!(parse(
transition_timing_function::parse,
"cubic-bezier(-1, 0, -1, 0"
)
.is_err());
assert!(
parse(
transition_timing_function::parse,
"cubic-bezier(-1, 0, 0, 0"
)
.is_err()
);
assert!(
parse(
transition_timing_function::parse,
"cubic-bezier(0, 0, -1, 0"
)
.is_err()
);
assert!(
parse(
transition_timing_function::parse,
"cubic-bezier(-1, 0, -1, 0"
)
.is_err()
);
assert!(parse(transition_timing_function::parse, "cubic-bezier(2, 0, 0, 0").is_err());
assert!(parse(transition_timing_function::parse, "cubic-bezier(0, 0, 2, 0").is_err());

View file

@ -9,7 +9,7 @@ use style::applicable_declarations::CascadePriority;
use style::context::QuirksMode;
use style::error_reporting::{ContextualParseError, ParseErrorReporter};
use style::media_queries::MediaList;
use style::properties::{longhands, Importance, PropertyDeclaration, PropertyDeclarationBlock};
use style::properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock, longhands};
use style::rule_tree::{CascadeLevel, RuleTree, StrongRuleNode, StyleSource};
use style::shared_lock::{SharedRwLock, StylesheetGuards};
use style::stylesheets::layer_rule::LayerOrder;

View file

@ -12,7 +12,7 @@ use style::font_metrics::FontMetrics;
use style::media_queries::{Device, MediaType};
use style::properties::style_structs::Font;
use style::properties::{
longhands, ComputedValues, Importance, PropertyDeclaration, PropertyDeclarationBlock,
ComputedValues, Importance, PropertyDeclaration, PropertyDeclarationBlock, longhands,
};
use style::queries::values::PrefersColorScheme;
use style::rule_tree::StyleSource;
@ -22,11 +22,11 @@ use style::servo::media_queries::FontMetricsProvider;
use style::shared_lock::SharedRwLock;
use style::stylesheets::StyleRule;
use style::stylist::{
needs_revalidation_for_testing, ContainerConditionId, LayerId, Rule, ScopeConditionId, Stylist,
ContainerConditionId, LayerId, Rule, ScopeConditionId, Stylist, needs_revalidation_for_testing,
};
use style::thread_state::{self, ThreadState};
use style::values::computed::font::GenericFontFamily;
use style::values::computed::Length;
use style::values::computed::font::GenericFontFamily;
use url::Url;
#[derive(Debug)]
@ -242,10 +242,12 @@ fn test_insert() {
.unwrap()[0]
.source_order
);
assert!(selector_map
.class_hash
.get(&Atom::from("intro"), QuirksMode::NoQuirks)
.is_none());
assert!(
selector_map
.class_hash
.get(&Atom::from("intro"), QuirksMode::NoQuirks)
.is_none()
);
}
fn mock_stylist() -> Stylist {