Repository: servo/servo
File: components/devtools/actors/browsing_context.rs (Rust)

Code before:

    pub(crate) fn frame_update(&self, request: &mut ClientRequest) {
        let _ = request.write_json_packet(&FrameUpdateReply {
            from: self.name(),
            type_: "frameUpdate".into(),
            frames: vec![FrameUpdateMsg {
                id: self.browsing_context_id.value(),
                is_top_level: true,
                title: self.title.borrow().clone(),
                url: self.url.borrow().clone(),
            }],
        });
    }

    pub fn simulate_color_scheme(&self, theme: Theme) -> Result<(), ()> {
        self.script_chan
            .send(SimulateColorScheme(self.pipeline_id(), theme))
            .map_err(|_| ())
    }

    pub fn pipeline_id(&self) -> PipelineId {
        *self.active_pipeline_id.borrow()
    }

    pub fn outer_window_id(&self) -> DevtoolsOuterWindowId {
        *self.active_outer_window_id.borrow()
    }
}

impl ActorEncode<BrowsingContextActorMsg> for BrowsingContextActor {
    fn encode(&self, _: &ActorRegistry) -> BrowsingContextActorMsg {
        BrowsingContextActorMsg {
            actor: self.name(),
            traits: BrowsingContextTraits {
                is_browsing_context: true,
                frames: true,
                log_in_page: false,
                navigation: true,
                supports_top_level_target_flag: true,
                watchpoints: true,
            },
            title: self.title.borrow().clone(),
            url: self.url.borrow().clone(),
            browser_id: self.browser_id.value(),
            browsing_context_id: self.browsing_context_id.value(),
            outer_window_id: self.outer_window_id().value(),
            is_top_level_target: true,
            accessibility_actor: self.accessibility.clone(),
            console_actor: self.console.clone(),
            css_properties_actor: self.css_properties.clone(),
            inspector_actor: self.inspector.clone(),

Review comment (suggestion):
If possible, `pub(crate)` is preferred as it allows the compiler to more reliably identify dead code:

```suggestion
    pub(crate) fn pipeline_id(&self) -> PipelineId {
        *self.active_pipeline_id.borrow()
    }

    pub(crate) fn outer_window_id(&self) -> DevtoolsOuterWindowId {
        *self.active_outer_window_id.borrow()
```

Code after:

    pub(crate) fn frame_update(&self, request: &mut ClientRequest) {
        let _ = request.write_json_packet(&FrameUpdateReply {
            from: self.name(),
            type_: "frameUpdate".into(),
            frames: vec![FrameUpdateMsg {
                id: self.browsing_context_id.value(),
                is_top_level: true,
                title: self.title.borrow().clone(),
                url: self.url.borrow().clone(),
            }],
        });
    }

    pub fn simulate_color_scheme(&self, theme: Theme) -> Result<(), ()> {
        self.script_chan
            .send(SimulateColorScheme(self.pipeline_id(), theme))
            .map_err(|_| ())
    }

    pub(crate) fn pipeline_id(&self) -> PipelineId {
        *self.active_pipeline_id.borrow()
    }

    pub(crate) fn outer_window_id(&self) -> DevtoolsOuterWindowId {
        *self.active_outer_window_id.borrow()
    }
}

impl ActorEncode<BrowsingContextActorMsg> for BrowsingContextActor {
    fn encode(&self, _: &ActorRegistry) -> BrowsingContextActorMsg {
        BrowsingContextActorMsg {
            actor: self.name(),
            traits: BrowsingContextTraits {
                is_browsing_context: true,
                frames: true,
                log_in_page: false,
                navigation: true,
                supports_top_level_target_flag: true,
                watchpoints: true,
            },
            title: self.title.borrow().clone(),
            url: self.url.borrow().clone(),
            browser_id: self.browser_id.value(),
            browsing_context_id: self.browsing_context_id.value(),
            outer_window_id: self.outer_window_id().value(),
            is_top_level_target: true,
            accessibility_actor: self.accessibility.clone(),
            console_actor: self.console.clone(),
            css_properties_actor: self.css_properties.clone(),
            inspector_actor: self.inspector.clone(),