Repository: servo/servo
File: components/constellation/constellation.rs (Rust)

Code before:

        // Shut down the fetch thread started above.
        exit_fetch_thread();
        join_handle
            .join()
            .expect("Failed to join on the fetch thread in the constellation");

        // Note: the last thing the constellation does, is asking the embedder to
        // shut down. This helps ensure we've shut down all our internal threads before
        // de-initializing Servo (see the `thread_count` warning on MacOS).
        debug!("Asking embedding layer to complete shutdown.");
        self.embedder_proxy.send(EmbedderMsg::ShutdownComplete);
    }

    /// Helper that sends a message to the event loop of a given pipeline.
    /// Returns `false` after printing a warning if the pipeline does not exist.
    fn send_handling_error(
        &mut self,
        pipeline_id: PipelineId,
        msg: ScriptThreadMessage,
        warn_msg: &str,
    ) -> bool {
        let result = match self.pipelines.get(&pipeline_id) {
            Some(pipeline) => pipeline.event_loop.send(msg),
            None => {
                warn!("{}: {}", pipeline_id, warn_msg);
                return false;
            },
        };
        if let Err(err) = result {
            self.handle_send_error(pipeline_id, err);
        }
        true
    }

    /// Generate a new pipeline id namespace.
    fn next_pipeline_namespace_id(&mut self) -> PipelineNamespaceId {
        let namespace_id = self.next_pipeline_namespace_id;
        let PipelineNamespaceId(ref mut i) = self.next_pipeline_namespace_id;
        *i += 1;
        namespace_id
    }

    fn next_browsing_context_group_id(&mut self) -> BrowsingContextGroupId {
        let id = self.browsing_context_group_next_id;
        self.browsing_context_group_next_id += 1;
        BrowsingContextGroupId(id)
    }

    fn get_event_loop(
        &mut self,

Review comment (suggestion):
As this change is about cleaning up and modernizing the code, can you please put the variable inline into the format strings now that Rust supports that? Here and elsewhere in the change.

```suggestion
                warn!("{pipeline_id}: {pipeline_missing_message}");
```

Code after:

        // Shut down the fetch thread started above.
        exit_fetch_thread();
        join_handle
            .join()
            .expect("Failed to join on the fetch thread in the constellation");

        // Note: the last thing the constellation does, is asking the embedder to
        // shut down. This helps ensure we've shut down all our internal threads before
        // de-initializing Servo (see the `thread_count` warning on MacOS).
        debug!("Asking embedding layer to complete shutdown.");
        self.embedder_proxy.send(EmbedderMsg::ShutdownComplete);
    }

    /// Helper that sends a message to the event loop of a given pipeline, logging the
    /// given failure message and returning `false` on failure.
    fn send_message_to_pipeline(
        &mut self,
        pipeline_id: PipelineId,
        message: ScriptThreadMessage,
        failure_message: &str,
    ) -> bool {
        let result = match self.pipelines.get(&pipeline_id) {
            Some(pipeline) => pipeline.event_loop.send(message),
            None => {
                warn!("{pipeline_id}: {failure_message}");
                return false;
            },
        };
        if let Err(err) = result {
            self.handle_send_error(pipeline_id, err);
        }
        true
    }

    /// Generate a new pipeline id namespace.
    fn next_pipeline_namespace_id(&mut self) -> PipelineNamespaceId {
        let namespace_id = self.next_pipeline_namespace_id;
        let PipelineNamespaceId(ref mut i) = self.next_pipeline_namespace_id;
        *i += 1;
        namespace_id
    }

    fn next_browsing_context_group_id(&mut self) -> BrowsingContextGroupId {
        let id = self.browsing_context_group_next_id;
        self.browsing_context_group_next_id += 1;
        BrowsingContextGroupId(id)
    }

    fn get_event_loop(
        &mut self,