From 4b2e8c38d10138e1174091e3e74a14a2c51e3a30 Mon Sep 17 00:00:00 2001 From: Jonathan Schwender <55576758+jschwe@users.noreply.github.com> Date: Wed, 25 Feb 2026 19:30:40 +0100 Subject: [PATCH] script bindings: Fix warning about unused span. (#42850) The span needs to be assigned to a variable, so that it drops at the end of scope. This was introduced in #42715. Additionally also switch tho the profile_traits macro to simplify the statement. Testing: Manually verified the warning is fixed. Signed-off-by: Jonathan Schwender --- Cargo.lock | 1 + components/script_bindings/Cargo.toml | 1 + components/script_bindings/settings_stack.rs | 10 ++-------- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 32a8bd9f27c..f8b3d82d464 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8053,6 +8053,7 @@ dependencies = [ "phf", "phf_codegen", "phf_shared", + "profile_traits", "regex", "serde_json", "servo_arc", diff --git a/components/script_bindings/Cargo.toml b/components/script_bindings/Cargo.toml index 806ac84c0b2..d27a4e7ec2b 100644 --- a/components/script_bindings/Cargo.toml +++ b/components/script_bindings/Cargo.toml @@ -34,6 +34,7 @@ malloc_size_of_derive = { workspace = true } num-traits = { workspace = true } parking_lot = { workspace = true } phf = "0.13" +profile_traits = { workspace = true } regex = { workspace = true } servo_arc = { workspace = true } servo_config = { path = "../config" } diff --git a/components/script_bindings/settings_stack.rs b/components/script_bindings/settings_stack.rs index 8f7ce1759b2..8ccfb61daec 100644 --- a/components/script_bindings/settings_stack.rs +++ b/components/script_bindings/settings_stack.rs @@ -32,20 +32,14 @@ pub struct StackEntry { /// pub fn run_a_script(global: &D::GlobalScope, f: impl FnOnce() -> R) -> R { let settings_stack = >::settings_stack(); - settings_stack.with(|stack| { + let _span = settings_stack.with(|stack| { trace!("Prepare to run script with {:p}", global); let mut stack = stack.borrow_mut(); stack.push(StackEntry { global: Dom::from_ref(global), kind: StackEntryKind::Entry, }); - #[cfg(feature = "tracing")] - tracing::info_span!( - "ScriptEvaluate", - servo_profiling = true, - url = global.get_url().to_string(), - ) - .entered() + profile_traits::info_span!("ScriptEvaluate", url = global.get_url().to_string()).entered() }); let r = f(); let stack_is_empty = settings_stack.with(|stack| {