Changed label and text to be generic over static strings and owned strings

This commit is contained in:
Mikayla Maki 2023-02-21 16:46:03 -08:00
parent ebf1da1de8
commit b500ed3171
24 changed files with 60 additions and 72 deletions

View file

@ -319,7 +319,7 @@ impl BufferSearchBar {
fn render_search_option(
&self,
option_supported: bool,
icon: &str,
icon: &'static str,
option: SearchOption,
cx: &mut RenderContext<Self>,
) -> Option<ElementBox> {
@ -337,7 +337,7 @@ impl BufferSearchBar {
.search
.option_button
.style_for(state, is_active);
Label::new(icon.to_string(), style.text.clone())
Label::new(icon, style.text.clone())
.contained()
.with_style(style.container)
.boxed()
@ -359,7 +359,7 @@ impl BufferSearchBar {
fn render_nav_button(
&self,
icon: &str,
icon: &'static str,
direction: Direction,
cx: &mut RenderContext<Self>,
) -> ElementBox {
@ -385,7 +385,7 @@ impl BufferSearchBar {
.search
.option_button
.style_for(state, false);
Label::new(icon.to_string(), style.text.clone())
Label::new(icon, style.text.clone())
.contained()
.with_style(style.container)
.boxed()

View file

@ -189,7 +189,7 @@ impl View for ProjectSearchView {
"No results"
};
MouseEventHandler::<Status>::new(0, cx, |_, _| {
Label::new(text.to_string(), theme.search.results_status.clone())
Label::new(text, theme.search.results_status.clone())
.aligned()
.contained()
.with_background_color(theme.editor.background)
@ -744,7 +744,7 @@ impl ProjectSearchBar {
fn render_nav_button(
&self,
icon: &str,
icon: &'static str,
direction: Direction,
cx: &mut RenderContext<Self>,
) -> ElementBox {
@ -770,7 +770,7 @@ impl ProjectSearchBar {
.search
.option_button
.style_for(state, false);
Label::new(icon.to_string(), style.text.clone())
Label::new(icon, style.text.clone())
.contained()
.with_style(style.container)
.boxed()
@ -792,7 +792,7 @@ impl ProjectSearchBar {
fn render_option_button(
&self,
icon: &str,
icon: &'static str,
option: SearchOption,
cx: &mut RenderContext<Self>,
) -> ElementBox {
@ -805,7 +805,7 @@ impl ProjectSearchBar {
.search
.option_button
.style_for(state, is_active);
Label::new(icon.to_string(), style.text.clone())
Label::new(icon, style.text.clone())
.contained()
.with_style(style.container)
.boxed()