diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs index 1acd379d7bf..b478845c66f 100644 --- a/components/constellation/constellation.rs +++ b/components/constellation/constellation.rs @@ -4951,7 +4951,9 @@ where // If there is no focus browsing context yet, the initial page has // not loaded, so there is nothing to save yet. let Some(top_level_browsing_context_id) = self.webviews.focused_webview().map(|(id, _)| id) - else { return ReadyToSave::NoTopLevelBrowsingContext }; + else { + return ReadyToSave::NoTopLevelBrowsingContext; + }; // If there are pending loads, wait for those to complete. if !self.pending_changes.is_empty() { diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs index 9128c7aab50..354dc923d6b 100644 --- a/components/gfx/text/shaping/harfbuzz.rs +++ b/components/gfx/text/shaping/harfbuzz.rs @@ -11,9 +11,8 @@ use app_units::Au; use euclid::default::Point2D; // Eventually we would like the shaper to be pluggable, as many operating systems have their own // shapers. For now, however, HarfBuzz is a hard dependency. -use harfbuzz_sys::hb_blob_t; use harfbuzz_sys::{ - hb_blob_create, hb_bool_t, hb_buffer_add_utf8, hb_buffer_create, hb_buffer_destroy, + hb_blob_create, hb_blob_t, hb_bool_t, hb_buffer_add_utf8, hb_buffer_create, hb_buffer_destroy, hb_buffer_get_glyph_infos, hb_buffer_get_glyph_positions, hb_buffer_get_length, hb_buffer_set_direction, hb_buffer_set_script, hb_buffer_t, hb_codepoint_t, hb_face_create_for_tables, hb_face_destroy, hb_face_t, hb_feature_t, hb_font_create, diff --git a/components/script/dom/bindings/buffer_source.rs b/components/script/dom/bindings/buffer_source.rs index 031ecf9c185..80fa00e408b 100644 --- a/components/script/dom/bindings/buffer_source.rs +++ b/components/script/dom/bindings/buffer_source.rs @@ -269,8 +269,10 @@ where buffer.get() }, }); - let Ok(array) = array as Result>, &mut ()> else{ - return Err(()) + let Ok(array) = + array as Result>, &mut ()> + else { + return Err(()); }; unsafe { let slice = (*array).as_slice(); @@ -305,9 +307,10 @@ where buffer.get() }, }); - let Ok(mut array) = array as Result>, &mut ()> else - { - return Err(()) + let Ok(mut array) = + array as Result>, &mut ()> + else { + return Err(()); }; unsafe { let slice = (*array).as_mut_slice(); diff --git a/ports/servoshell/minibrowser.rs b/ports/servoshell/minibrowser.rs index f5727baf438..cd6cc01fa5d 100644 --- a/ports/servoshell/minibrowser.rs +++ b/ports/servoshell/minibrowser.rs @@ -198,7 +198,9 @@ impl Minibrowser { let rect = egui::Rect::from_min_size(min, size); ui.allocate_space(size); - let Some(servo_fbo) = servo_framebuffer_id else { return }; + let Some(servo_fbo) = servo_framebuffer_id else { + return; + }; ui.painter().add(PaintCallback { rect, callback: Arc::new(CallbackFn::new(move |info, painter| { diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 17c9f667d68..36c51fd250b 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -39,6 +39,15 @@ PROJECT_TOPLEVEL_PATH = os.path.abspath(os.path.join(SCRIPT_PATH, "..", "..")) WEB_PLATFORM_TESTS_PATH = os.path.join("tests", "wpt", "tests") SERVO_TESTS_PATH = os.path.join("tests", "wpt", "mozilla", "tests") +# Servo depends on several `rustfmt` options that are unstable. These are still +# supported by stable `rustfmt` if they are passed as these command-line arguments. +UNSTABLE_RUSTFMT_ARGUMENTS = [ + "--config", "unstable_features=true", + "--config", "binop_separator=Back", + "--config", "imports_granularity=Module", + "--config", "group_imports=StdExternalCrate", +] + def format_toml_files_with_taplo(check_only: bool = True) -> int: taplo = shutil.which("taplo") @@ -206,12 +215,12 @@ class MachCommands(CommandBase): def test_tidy(self, all_files, no_progress): tidy_failed = tidy.scan(not all_files, not no_progress) - call(["rustup", "install", "nightly-2023-03-18"]) - call(["rustup", "component", "add", "rustfmt", "--toolchain", "nightly-2023-03-18"]) - rustfmt_failed = call(["cargo", "+nightly-2023-03-18", "fmt", "--", "--check"]) + print("\r ➤ Checking formatting of rust files...") + rustfmt_failed = call(["cargo", "fmt", "--", *UNSTABLE_RUSTFMT_ARGUMENTS, "--check"]) if rustfmt_failed: print("Run `./mach fmt` to fix the formatting") + print("\r ➤ Checking formatting of toml files...") taplo_failed = format_toml_files_with_taplo() tidy_failed = tidy_failed or rustfmt_failed or taplo_failed @@ -323,9 +332,7 @@ class MachCommands(CommandBase): if result != 0: return result - call(["rustup", "install", "nightly-2023-03-18"]) - call(["rustup", "component", "add", "rustfmt", "--toolchain", "nightly-2023-03-18"]) - return call(["cargo", "+nightly-2023-03-18", "fmt"]) + return call(["cargo", "fmt", "--", *UNSTABLE_RUSTFMT_ARGUMENTS]) @Command('update-wpt', description='Update the web platform tests', diff --git a/rustfmt.toml b/rustfmt.toml index ff489540a45..ecd1b1465d0 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,6 +1,2 @@ match_block_trailing_comma = true -binop_separator = "Back" reorder_imports = true -group_imports = "StdExternalCrate" -imports_granularity = "Module" -ignore = ["third_party"] diff --git a/third_party/blurmac/src/framework.rs b/third_party/blurmac/src/framework.rs index a441b9ecb18..23f429a422c 100644 --- a/third_party/blurmac/src/framework.rs +++ b/third_party/blurmac/src/framework.rs @@ -485,6 +485,8 @@ pub mod cb { // CBCentralManagerScanOption...Key // CBAdvertisementData...Key - pub use self::link::CBAdvertisementDataServiceUUIDsKey as ADVERTISEMENTDATASERVICEUUIDSKEY; - pub use self::link::CBCentralManagerScanOptionAllowDuplicatesKey as CENTRALMANAGERSCANOPTIONALLOWDUPLICATESKEY; + pub use self::link::{ + CBAdvertisementDataServiceUUIDsKey as ADVERTISEMENTDATASERVICEUUIDSKEY, + CBCentralManagerScanOptionAllowDuplicatesKey as CENTRALMANAGERSCANOPTIONALLOWDUPLICATESKEY, + }; }