Repository: servo/servo
File: components/config/opts.rs (Rust)

Code before:
/// Debug options for Servo, currently set on the command line with -Z
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct DiagnosticsLogging {
    /// List all the debug options.
    pub help: bool,

    /// Print the DOM after each restyle.
    pub log_style_tree: bool,

    /// Log the rule tree.
    pub log_rule_tree: bool,

    /// Log the fragment tree after each layout.
    pub log_flow_tree: bool,

    /// Log the stacking context tree after each layout.
    pub log_stacking_context_tree: bool,

    /// Log the scroll tree after each layout.
    ///
    /// Displays the hierarchy of scrollable areas and their properties.
    pub log_scroll_tree: bool,

    /// Log the display list after each layout.
    pub log_display_list: bool,

    /// Log notifications when a relayout occurs.
    pub relayout_event: bool,

    /// Periodically log on which events script threads spend their processing time.
    pub profile_script_events: bool,

    /// Log style sharing cache statistics to after each restyle.
    ///
    /// Shows hit/miss statistics for the style sharing cache
    pub log_style_statistics: bool,

    /// Log garbage collection passes and their durations.
    pub gc_profile: bool,
}

impl DiagnosticsLogging {
    pub fn extend(&mut self, debug_string: String) -> Result<(), String> {
        for option in debug_string.split(',') {
            match option {
                "help" => self.help = true,
                "log-display-list" => self.log_display_list = true,
                "log-stacking-context-tree" => self.log_stacking_context_tree = true,
                "log-flow-tree" => self.log_flow_tree = true,
                "log-rule-tree" => self.log_rule_tree = true,
                "log-style-tree" => self.log_style_tree = true,

Review comment (suggestion):
For the sake of consistency, I would remove the `log_` prefix.

```suggestion
    pub style_tree: bool,

    /// Log the rule tree.
    pub rule_tree: bool,

    /// Log the fragment tree after each layout.
    pub flow_tree: bool,

    /// Log the stacking context tree after each layout.
    pub stacking_context_tree: bool,

    /// Log the scroll tree after each layout.
    ///
    /// Displays the hierarchy of scrollable areas and their properties.
    pub scroll_tree: bool,

    /// Log the display list after each layout.
    pub display_list: bool,

```

Code after:
/// Debug options for Servo, currently set on the command line with -Z
#[derive(Clone, Debug, Default, Deserialize, Serialize)]
pub struct DiagnosticsLogging {
    /// List all the debug options.
    pub help: bool,

    /// Print the DOM after each restyle.
    pub style_tree: bool,

    /// Log the rule tree.
    pub rule_tree: bool,

    /// Log the fragment tree after each layout.
    pub flow_tree: bool,

    /// Log the stacking context tree after each layout.
    pub stacking_context_tree: bool,

    /// Log the scroll tree after each layout.
    ///
    /// Displays the hierarchy of scrollable areas and their properties.
    pub scroll_tree: bool,

    /// Log the display list after each layout.
    pub display_list: bool,

    /// Log notifications when a relayout occurs.
    pub relayout_event: bool,

    /// Periodically log on which events script threads spend their processing time.
    pub profile_script_events: bool,

    /// Log style sharing cache statistics to after each restyle.
    ///
    /// Shows hit/miss statistics for the style sharing cache
    pub style_statistics: bool,

    /// Log garbage collection passes and their durations.
    pub gc_profile: bool,
}

impl DiagnosticsLogging {
    pub fn extend(&mut self, debug_string: String) -> Result<(), String> {
        for option in debug_string.split(',') {
            match option {
                "help" => self.help = true,
                "display-list" => self.display_list = true,
                "stacking-context-tree" => self.stacking_context_tree = true,
                "flow-tree" => self.flow_tree = true,
                "rule-tree" => self.rule_tree = true,
                "style-tree" => self.style_tree = true,