Fix Clippy warnings in theme crate (#8715)

This PR fixes a number of Clippy warnings in the `theme` crate.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-03-02 11:11:08 -05:00 committed by GitHub
parent 6fcd57ac53
commit f9dc871422
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 159 additions and 157 deletions

View file

@ -72,7 +72,7 @@ pub(crate) fn one_dark() -> Theme {
icon_muted: hsla(220.0 / 360., 12.1 / 100., 66.1 / 100., 1.0),
icon_disabled: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
icon_placeholder: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
icon_accent: blue.into(),
icon_accent: blue,
status_bar_background: bg,
title_bar_background: bg,
toolbar_background: editor,
@ -218,7 +218,7 @@ pub(crate) fn one_dark() -> Theme {
(
"link_uri".into(),
HighlightStyle {
color: Some(teal.into()),
color: Some(teal),
font_style: Some(FontStyle::Italic),
..HighlightStyle::default()
},

View file

@ -134,7 +134,7 @@ impl ThemeRegistry {
color: highlight
.color
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
font_style: highlight.font_style.map(Into::into),
font_weight: highlight.font_weight.map(Into::into),
..Default::default()
@ -248,7 +248,7 @@ impl ThemeRegistry {
}
pub async fn read_user_theme(theme_path: &Path, fs: Arc<dyn Fs>) -> Result<ThemeFamilyContent> {
let reader = fs.open_sync(&theme_path).await?;
let reader = fs.open_sync(theme_path).await?;
let theme = serde_json_lenient::from_reader(reader)?;
Ok(theme)

View file

@ -91,7 +91,7 @@ impl ThemeStyleContent {
color: style
.color
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
..Default::default()
},
)
@ -489,351 +489,351 @@ impl ThemeColorsContent {
border: self
.border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
border_variant: self
.border_variant
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
border_focused: self
.border_focused
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
border_selected: self
.border_selected
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
border_transparent: self
.border_transparent
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
border_disabled: self
.border_disabled
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
elevated_surface_background: self
.elevated_surface_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
surface_background: self
.surface_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
background: self
.background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
element_background: self
.element_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
element_hover: self
.element_hover
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
element_active: self
.element_active
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
element_selected: self
.element_selected
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
element_disabled: self
.element_disabled
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
drop_target_background: self
.drop_target_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
ghost_element_background: self
.ghost_element_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
ghost_element_hover: self
.ghost_element_hover
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
ghost_element_active: self
.ghost_element_active
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
ghost_element_selected: self
.ghost_element_selected
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
ghost_element_disabled: self
.ghost_element_disabled
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
text: self
.text
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
text_muted: self
.text_muted
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
text_placeholder: self
.text_placeholder
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
text_disabled: self
.text_disabled
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
text_accent: self
.text_accent
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
icon: self
.icon
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
icon_muted: self
.icon_muted
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
icon_disabled: self
.icon_disabled
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
icon_placeholder: self
.icon_placeholder
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
icon_accent: self
.icon_accent
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
status_bar_background: self
.status_bar_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
title_bar_background: self
.title_bar_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
toolbar_background: self
.toolbar_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
tab_bar_background: self
.tab_bar_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
tab_inactive_background: self
.tab_inactive_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
tab_active_background: self
.tab_active_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
search_match_background: self
.search_match_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
panel_background: self
.panel_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
panel_focused_border: self
.panel_focused_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
pane_focused_border: self
.pane_focused_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
scrollbar_thumb_background: self
.scrollbar_thumb_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
scrollbar_thumb_hover_background: self
.scrollbar_thumb_hover_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
scrollbar_thumb_border: self
.scrollbar_thumb_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
scrollbar_track_background: self
.scrollbar_track_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
scrollbar_track_border: self
.scrollbar_track_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_foreground: self
.editor_foreground
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_background: self
.editor_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_gutter_background: self
.editor_gutter_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_subheader_background: self
.editor_subheader_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_active_line_background: self
.editor_active_line_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_highlighted_line_background: self
.editor_highlighted_line_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_line_number: self
.editor_line_number
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_active_line_number: self
.editor_active_line_number
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_invisible: self
.editor_invisible
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_wrap_guide: self
.editor_wrap_guide
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_active_wrap_guide: self
.editor_active_wrap_guide
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_document_highlight_read_background: self
.editor_document_highlight_read_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
editor_document_highlight_write_background: self
.editor_document_highlight_write_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_background: self
.terminal_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_foreground: self
.terminal_foreground
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_bright_foreground: self
.terminal_bright_foreground
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_dim_foreground: self
.terminal_dim_foreground
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_black: self
.terminal_ansi_black
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_bright_black: self
.terminal_ansi_bright_black
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_dim_black: self
.terminal_ansi_dim_black
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_red: self
.terminal_ansi_red
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_bright_red: self
.terminal_ansi_bright_red
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_dim_red: self
.terminal_ansi_dim_red
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_green: self
.terminal_ansi_green
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_bright_green: self
.terminal_ansi_bright_green
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_dim_green: self
.terminal_ansi_dim_green
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_yellow: self
.terminal_ansi_yellow
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_bright_yellow: self
.terminal_ansi_bright_yellow
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_dim_yellow: self
.terminal_ansi_dim_yellow
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_blue: self
.terminal_ansi_blue
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_bright_blue: self
.terminal_ansi_bright_blue
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_dim_blue: self
.terminal_ansi_dim_blue
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_magenta: self
.terminal_ansi_magenta
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_bright_magenta: self
.terminal_ansi_bright_magenta
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_dim_magenta: self
.terminal_ansi_dim_magenta
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_cyan: self
.terminal_ansi_cyan
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_bright_cyan: self
.terminal_ansi_bright_cyan
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_dim_cyan: self
.terminal_ansi_dim_cyan
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_white: self
.terminal_ansi_white
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_bright_white: self
.terminal_ansi_bright_white
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
terminal_ansi_dim_white: self
.terminal_ansi_dim_white
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
link_text_hover: self
.link_text_hover
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
}
}
}
@ -990,171 +990,171 @@ impl StatusColorsContent {
conflict: self
.conflict
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
conflict_background: self
.conflict_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
conflict_border: self
.conflict_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
created: self
.created
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
created_background: self
.created_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
created_border: self
.created_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
deleted: self
.deleted
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
deleted_background: self
.deleted_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
deleted_border: self
.deleted_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
error: self
.error
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
error_background: self
.error_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
error_border: self
.error_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
hidden: self
.hidden
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
hidden_background: self
.hidden_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
hidden_border: self
.hidden_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
hint: self
.hint
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
hint_background: self
.hint_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
hint_border: self
.hint_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
ignored: self
.ignored
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
ignored_background: self
.ignored_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
ignored_border: self
.ignored_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
info: self
.info
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
info_background: self
.info_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
info_border: self
.info_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
modified: self
.modified
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
modified_background: self
.modified_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
modified_border: self
.modified_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
predictive: self
.predictive
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
predictive_background: self
.predictive_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
predictive_border: self
.predictive_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
renamed: self
.renamed
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
renamed_background: self
.renamed_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
renamed_border: self
.renamed_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
success: self
.success
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
success_background: self
.success_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
success_border: self
.success_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
unreachable: self
.unreachable
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
unreachable_background: self
.unreachable_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
unreachable_border: self
.unreachable_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
warning: self
.warning
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
warning_background: self
.warning_background
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
warning_border: self
.warning_border
.as_ref()
.and_then(|color| try_parse_color(&color).ok()),
.and_then(|color| try_parse_color(color).ok()),
}
}
}
@ -1208,19 +1208,21 @@ impl JsonSchema for FontWeightContent {
}
fn json_schema(_: &mut SchemaGenerator) -> Schema {
let mut schema_object = SchemaObject::default();
schema_object.enum_values = Some(vec![
100.into(),
200.into(),
300.into(),
400.into(),
500.into(),
600.into(),
700.into(),
800.into(),
900.into(),
]);
schema_object.into()
SchemaObject {
enum_values: Some(vec![
100.into(),
200.into(),
300.into(),
400.into(),
500.into(),
600.into(),
700.into(),
800.into(),
900.into(),
]),
..Default::default()
}
.into()
}
}

View file

@ -48,14 +48,14 @@ impl ThemeSettings {
// If the selected theme doesn't exist, fall back to a default theme
// based on the system appearance.
let theme_registry = ThemeRegistry::global(cx);
if theme_registry.get(&theme_name).ok().is_none() {
if theme_registry.get(theme_name).ok().is_none() {
theme_name = match *system_appearance {
Appearance::Light => "One Light",
Appearance::Dark => "One Dark",
};
};
if let Some(_theme) = theme_settings.switch_theme(&theme_name, cx) {
if let Some(_theme) = theme_settings.switch_theme(theme_name, cx) {
ThemeSettings::override_global(theme_settings, cx);
}
}
@ -220,7 +220,7 @@ impl ThemeSettings {
let mut new_theme = None;
if let Some(theme) = themes.get(&theme).log_err() {
if let Some(theme) = themes.get(theme).log_err() {
self.active_theme = theme.clone();
new_theme = Some(theme);
}
@ -313,13 +313,13 @@ impl settings::Settings for ThemeSettings {
ui_font_size: defaults.ui_font_size.unwrap().into(),
ui_font: Font {
family: defaults.ui_font_family.clone().unwrap().into(),
features: defaults.ui_font_features.clone().unwrap(),
features: defaults.ui_font_features.unwrap(),
weight: Default::default(),
style: Default::default(),
},
buffer_font: Font {
family: defaults.buffer_font_family.clone().unwrap().into(),
features: defaults.buffer_font_features.clone().unwrap(),
features: defaults.buffer_font_features.unwrap(),
weight: FontWeight::default(),
style: FontStyle::default(),
},
@ -333,7 +333,7 @@ impl settings::Settings for ThemeSettings {
theme_overrides: None,
};
for value in user_values.into_iter().copied().cloned() {
for value in user_values.iter().copied().cloned() {
if let Some(value) = value.buffer_font_family {
this.buffer_font.family = value.into();
}

View file

@ -151,19 +151,19 @@ impl PlayerColors {
return;
}
for (idx, player) in user_player_colors.into_iter().enumerate() {
for (idx, player) in user_player_colors.iter().enumerate() {
let cursor = player
.cursor
.as_ref()
.and_then(|color| try_parse_color(&color).ok());
.and_then(|color| try_parse_color(color).ok());
let background = player
.background
.as_ref()
.and_then(|color| try_parse_color(&color).ok());
.and_then(|color| try_parse_color(color).ok());
let selection = player
.selection
.as_ref()
.and_then(|color| try_parse_color(&color).ok());
.and_then(|color| try_parse_color(color).ok());
if let Some(player_color) = self.0.get_mut(idx) {
*player_color = PlayerColor {