Repository: lapce/lapce
File: lapce-ui/src/settings.rs (Rust)

Code before:
                    shadow_width,
                    data.config
                        .get_color_unchecked(LapceTheme::LAPCE_DROPDOWN_SHADOW),
                );
            });

            ctx.fill(
                Size::new(self.switcher_rect.width(), self.switcher_line_height)
                    .to_rect()
                    .with_origin(
                        self.switcher_rect.origin()
                            + (0.0, self.active as f64 * self.switcher_line_height),
                    ),
                data.config
                    .get_color_unchecked(LapceTheme::EDITOR_BACKGROUND),
            );

            static SETTINGS_SECTIONS: [&str; 3] = ["Core Settings", "Editor Settings", "Keybindings"];

            for (i, text) in SETTINGS_SECTIONS
                .iter()
                .enumerate()
            {
                let text_layout = ctx
                    .text()
                    .new_text_layout(*text)
                    .font(FontFamily::SYSTEM_UI, 14.0)
                    .text_color(
                        data.config
                            .get_color_unchecked(LapceTheme::EDITOR_FOREGROUND)
                            .clone(),
                    )
                    .build()
                    .unwrap();
                let text_size = text_layout.size();
                ctx.draw_text(
                    &text_layout,
                    self.switcher_rect.origin()
                        + (
                            20.0,
                            i as f64 * self.switcher_line_height
                                + (self.switcher_line_height / 2.0
                                    - text_size.height / 2.0),
                        ),
                );
            }

            ctx.blurred_rect(
                self.header_rect,
                shadow_width,
                data.config

Review comment (bug):
I might be wrong, but I think calling `into_iter()` on the array (which should be a `const`, really) would allow removing this dereference.

Code after:
                    shadow_width,
                    data.config
                        .get_color_unchecked(LapceTheme::LAPCE_DROPDOWN_SHADOW),
                );
            });

            ctx.fill(
                Size::new(self.switcher_rect.width(), self.switcher_line_height)
                    .to_rect()
                    .with_origin(
                        self.switcher_rect.origin()
                            + (0.0, self.active as f64 * self.switcher_line_height),
                    ),
                data.config
                    .get_color_unchecked(LapceTheme::EDITOR_BACKGROUND),
            );

            const SETTINGS_SECTIONS: [&str; 3] = ["Core Settings", "Editor Settings", "Keybindings"];

            for (i, text) in SETTINGS_SECTIONS
                .into_iter()
                .enumerate()
            {
                let text_layout = ctx
                    .text()
                    .new_text_layout(text)
                    .font(FontFamily::SYSTEM_UI, 14.0)
                    .text_color(
                        data.config
                            .get_color_unchecked(LapceTheme::EDITOR_FOREGROUND)
                            .clone(),
                    )
                    .build()
                    .unwrap();
                let text_size = text_layout.size();
                ctx.draw_text(
                    &text_layout,
                    self.switcher_rect.origin()
                        + (
                            20.0,
                            i as f64 * self.switcher_line_height
                                + (self.switcher_line_height / 2.0
                                    - text_size.height / 2.0),
                        ),
                );
            }

            ctx.blurred_rect(
                self.header_rect,
                shadow_width,
                data.config