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_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_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_placeholder: hsla(220.0 / 360., 6.4 / 100., 45.7 / 100., 1.0),
icon_accent: blue.into(), icon_accent: blue,
status_bar_background: bg, status_bar_background: bg,
title_bar_background: bg, title_bar_background: bg,
toolbar_background: editor, toolbar_background: editor,
@ -218,7 +218,7 @@ pub(crate) fn one_dark() -> Theme {
( (
"link_uri".into(), "link_uri".into(),
HighlightStyle { HighlightStyle {
color: Some(teal.into()), color: Some(teal),
font_style: Some(FontStyle::Italic), font_style: Some(FontStyle::Italic),
..HighlightStyle::default() ..HighlightStyle::default()
}, },

View file

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

View file

@ -91,7 +91,7 @@ impl ThemeStyleContent {
color: style color: style
.color .color
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
..Default::default() ..Default::default()
}, },
) )
@ -489,351 +489,351 @@ impl ThemeColorsContent {
border: self border: self
.border .border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
border_variant: self border_variant: self
.border_variant .border_variant
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
border_focused: self border_focused: self
.border_focused .border_focused
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
border_selected: self border_selected: self
.border_selected .border_selected
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
border_transparent: self border_transparent: self
.border_transparent .border_transparent
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
border_disabled: self border_disabled: self
.border_disabled .border_disabled
.as_ref() .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: self
.elevated_surface_background .elevated_surface_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
surface_background: self surface_background: self
.surface_background .surface_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
background: self background: self
.background .background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
element_background: self element_background: self
.element_background .element_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
element_hover: self element_hover: self
.element_hover .element_hover
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
element_active: self element_active: self
.element_active .element_active
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
element_selected: self element_selected: self
.element_selected .element_selected
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
element_disabled: self element_disabled: self
.element_disabled .element_disabled
.as_ref() .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: self
.drop_target_background .drop_target_background
.as_ref() .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: self
.ghost_element_background .ghost_element_background
.as_ref() .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: self
.ghost_element_hover .ghost_element_hover
.as_ref() .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: self
.ghost_element_active .ghost_element_active
.as_ref() .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: self
.ghost_element_selected .ghost_element_selected
.as_ref() .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: self
.ghost_element_disabled .ghost_element_disabled
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
text: self text: self
.text .text
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
text_muted: self text_muted: self
.text_muted .text_muted
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
text_placeholder: self text_placeholder: self
.text_placeholder .text_placeholder
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
text_disabled: self text_disabled: self
.text_disabled .text_disabled
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
text_accent: self text_accent: self
.text_accent .text_accent
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
icon: self icon: self
.icon .icon
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
icon_muted: self icon_muted: self
.icon_muted .icon_muted
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
icon_disabled: self icon_disabled: self
.icon_disabled .icon_disabled
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
icon_placeholder: self icon_placeholder: self
.icon_placeholder .icon_placeholder
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
icon_accent: self icon_accent: self
.icon_accent .icon_accent
.as_ref() .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: self
.status_bar_background .status_bar_background
.as_ref() .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: self
.title_bar_background .title_bar_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
toolbar_background: self toolbar_background: self
.toolbar_background .toolbar_background
.as_ref() .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: self
.tab_bar_background .tab_bar_background
.as_ref() .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: self
.tab_inactive_background .tab_inactive_background
.as_ref() .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: self
.tab_active_background .tab_active_background
.as_ref() .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: self
.search_match_background .search_match_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
panel_background: self panel_background: self
.panel_background .panel_background
.as_ref() .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: self
.panel_focused_border .panel_focused_border
.as_ref() .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: self
.pane_focused_border .pane_focused_border
.as_ref() .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: self
.scrollbar_thumb_background .scrollbar_thumb_background
.as_ref() .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: self
.scrollbar_thumb_hover_background .scrollbar_thumb_hover_background
.as_ref() .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: self
.scrollbar_thumb_border .scrollbar_thumb_border
.as_ref() .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: self
.scrollbar_track_background .scrollbar_track_background
.as_ref() .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: self
.scrollbar_track_border .scrollbar_track_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
editor_foreground: self editor_foreground: self
.editor_foreground .editor_foreground
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
editor_background: self editor_background: self
.editor_background .editor_background
.as_ref() .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: self
.editor_gutter_background .editor_gutter_background
.as_ref() .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: self
.editor_subheader_background .editor_subheader_background
.as_ref() .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: self
.editor_active_line_background .editor_active_line_background
.as_ref() .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: self
.editor_highlighted_line_background .editor_highlighted_line_background
.as_ref() .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: self
.editor_line_number .editor_line_number
.as_ref() .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: self
.editor_active_line_number .editor_active_line_number
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
editor_invisible: self editor_invisible: self
.editor_invisible .editor_invisible
.as_ref() .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: self
.editor_wrap_guide .editor_wrap_guide
.as_ref() .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: self
.editor_active_wrap_guide .editor_active_wrap_guide
.as_ref() .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: self
.editor_document_highlight_read_background .editor_document_highlight_read_background
.as_ref() .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: self
.editor_document_highlight_write_background .editor_document_highlight_write_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
terminal_background: self terminal_background: self
.terminal_background .terminal_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
terminal_foreground: self terminal_foreground: self
.terminal_foreground .terminal_foreground
.as_ref() .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: self
.terminal_bright_foreground .terminal_bright_foreground
.as_ref() .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: self
.terminal_dim_foreground .terminal_dim_foreground
.as_ref() .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: self
.terminal_ansi_black .terminal_ansi_black
.as_ref() .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: self
.terminal_ansi_bright_black .terminal_ansi_bright_black
.as_ref() .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: self
.terminal_ansi_dim_black .terminal_ansi_dim_black
.as_ref() .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: self
.terminal_ansi_red .terminal_ansi_red
.as_ref() .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: self
.terminal_ansi_bright_red .terminal_ansi_bright_red
.as_ref() .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: self
.terminal_ansi_dim_red .terminal_ansi_dim_red
.as_ref() .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: self
.terminal_ansi_green .terminal_ansi_green
.as_ref() .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: self
.terminal_ansi_bright_green .terminal_ansi_bright_green
.as_ref() .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: self
.terminal_ansi_dim_green .terminal_ansi_dim_green
.as_ref() .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: self
.terminal_ansi_yellow .terminal_ansi_yellow
.as_ref() .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: self
.terminal_ansi_bright_yellow .terminal_ansi_bright_yellow
.as_ref() .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: self
.terminal_ansi_dim_yellow .terminal_ansi_dim_yellow
.as_ref() .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: self
.terminal_ansi_blue .terminal_ansi_blue
.as_ref() .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: self
.terminal_ansi_bright_blue .terminal_ansi_bright_blue
.as_ref() .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: self
.terminal_ansi_dim_blue .terminal_ansi_dim_blue
.as_ref() .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: self
.terminal_ansi_magenta .terminal_ansi_magenta
.as_ref() .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: self
.terminal_ansi_bright_magenta .terminal_ansi_bright_magenta
.as_ref() .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: self
.terminal_ansi_dim_magenta .terminal_ansi_dim_magenta
.as_ref() .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: self
.terminal_ansi_cyan .terminal_ansi_cyan
.as_ref() .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: self
.terminal_ansi_bright_cyan .terminal_ansi_bright_cyan
.as_ref() .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: self
.terminal_ansi_dim_cyan .terminal_ansi_dim_cyan
.as_ref() .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: self
.terminal_ansi_white .terminal_ansi_white
.as_ref() .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: self
.terminal_ansi_bright_white .terminal_ansi_bright_white
.as_ref() .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: self
.terminal_ansi_dim_white .terminal_ansi_dim_white
.as_ref() .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: self
.link_text_hover .link_text_hover
.as_ref() .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: self
.conflict .conflict
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
conflict_background: self conflict_background: self
.conflict_background .conflict_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
conflict_border: self conflict_border: self
.conflict_border .conflict_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
created: self created: self
.created .created
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
created_background: self created_background: self
.created_background .created_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
created_border: self created_border: self
.created_border .created_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
deleted: self deleted: self
.deleted .deleted
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
deleted_background: self deleted_background: self
.deleted_background .deleted_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
deleted_border: self deleted_border: self
.deleted_border .deleted_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
error: self error: self
.error .error
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
error_background: self error_background: self
.error_background .error_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
error_border: self error_border: self
.error_border .error_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
hidden: self hidden: self
.hidden .hidden
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
hidden_background: self hidden_background: self
.hidden_background .hidden_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
hidden_border: self hidden_border: self
.hidden_border .hidden_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
hint: self hint: self
.hint .hint
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
hint_background: self hint_background: self
.hint_background .hint_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
hint_border: self hint_border: self
.hint_border .hint_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
ignored: self ignored: self
.ignored .ignored
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
ignored_background: self ignored_background: self
.ignored_background .ignored_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
ignored_border: self ignored_border: self
.ignored_border .ignored_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
info: self info: self
.info .info
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
info_background: self info_background: self
.info_background .info_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
info_border: self info_border: self
.info_border .info_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
modified: self modified: self
.modified .modified
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
modified_background: self modified_background: self
.modified_background .modified_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
modified_border: self modified_border: self
.modified_border .modified_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
predictive: self predictive: self
.predictive .predictive
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
predictive_background: self predictive_background: self
.predictive_background .predictive_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
predictive_border: self predictive_border: self
.predictive_border .predictive_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
renamed: self renamed: self
.renamed .renamed
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
renamed_background: self renamed_background: self
.renamed_background .renamed_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
renamed_border: self renamed_border: self
.renamed_border .renamed_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
success: self success: self
.success .success
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
success_background: self success_background: self
.success_background .success_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
success_border: self success_border: self
.success_border .success_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
unreachable: self unreachable: self
.unreachable .unreachable
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
unreachable_background: self unreachable_background: self
.unreachable_background .unreachable_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
unreachable_border: self unreachable_border: self
.unreachable_border .unreachable_border
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
warning: self warning: self
.warning .warning
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
warning_background: self warning_background: self
.warning_background .warning_background
.as_ref() .as_ref()
.and_then(|color| try_parse_color(&color).ok()), .and_then(|color| try_parse_color(color).ok()),
warning_border: self warning_border: self
.warning_border .warning_border
.as_ref() .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 { fn json_schema(_: &mut SchemaGenerator) -> Schema {
let mut schema_object = SchemaObject::default(); SchemaObject {
schema_object.enum_values = Some(vec![ enum_values: Some(vec![
100.into(), 100.into(),
200.into(), 200.into(),
300.into(), 300.into(),
400.into(), 400.into(),
500.into(), 500.into(),
600.into(), 600.into(),
700.into(), 700.into(),
800.into(), 800.into(),
900.into(), 900.into(),
]); ]),
schema_object.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 // If the selected theme doesn't exist, fall back to a default theme
// based on the system appearance. // based on the system appearance.
let theme_registry = ThemeRegistry::global(cx); 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 { theme_name = match *system_appearance {
Appearance::Light => "One Light", Appearance::Light => "One Light",
Appearance::Dark => "One Dark", 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); ThemeSettings::override_global(theme_settings, cx);
} }
} }
@ -220,7 +220,7 @@ impl ThemeSettings {
let mut new_theme = None; 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(); self.active_theme = theme.clone();
new_theme = Some(theme); new_theme = Some(theme);
} }
@ -313,13 +313,13 @@ impl settings::Settings for ThemeSettings {
ui_font_size: defaults.ui_font_size.unwrap().into(), ui_font_size: defaults.ui_font_size.unwrap().into(),
ui_font: Font { ui_font: Font {
family: defaults.ui_font_family.clone().unwrap().into(), family: defaults.ui_font_family.clone().unwrap().into(),
features: defaults.ui_font_features.clone().unwrap(), features: defaults.ui_font_features.unwrap(),
weight: Default::default(), weight: Default::default(),
style: Default::default(), style: Default::default(),
}, },
buffer_font: Font { buffer_font: Font {
family: defaults.buffer_font_family.clone().unwrap().into(), family: defaults.buffer_font_family.clone().unwrap().into(),
features: defaults.buffer_font_features.clone().unwrap(), features: defaults.buffer_font_features.unwrap(),
weight: FontWeight::default(), weight: FontWeight::default(),
style: FontStyle::default(), style: FontStyle::default(),
}, },
@ -333,7 +333,7 @@ impl settings::Settings for ThemeSettings {
theme_overrides: None, 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 { if let Some(value) = value.buffer_font_family {
this.buffer_font.family = value.into(); this.buffer_font.family = value.into();
} }

View file

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