Remove to_string on calls to new_text_layout

Only on the calls which are passing a static
string, this is always safe.
This commit is contained in:
Philip Daniels 2022-04-06 21:07:08 +01:00
parent c95fff30f5
commit 4e61787b5f
3 changed files with 12 additions and 12 deletions

View File

@ -488,7 +488,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
);
let text = ctx
.text()
.new_text_layout("Save".to_string())
.new_text_layout("Save")
.font(FontFamily::SYSTEM_UI, 13.0)
.text_color(
data.config
@ -524,7 +524,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
);
let text = ctx
.text()
.new_text_layout("Cancel".to_string())
.new_text_layout("Cancel")
.font(FontFamily::SYSTEM_UI, 13.0)
.text_color(
data.config
@ -612,7 +612,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
let text_layout = ctx
.text()
.new_text_layout("Command".to_string())
.new_text_layout("Command")
.font(FontFamily::SYSTEM_UI, 14.0)
.default_attribute(TextAttribute::Weight(FontWeight::BOLD))
.text_color(
@ -630,7 +630,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
let text_layout = ctx
.text()
.new_text_layout("Keybinding".to_string())
.new_text_layout("Keybinding")
.font(FontFamily::SYSTEM_UI, 14.0)
.default_attribute(TextAttribute::Weight(FontWeight::BOLD))
.text_color(
@ -651,7 +651,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
let text_layout = ctx
.text()
.new_text_layout("When".to_string())
.new_text_layout("When")
.font(FontFamily::SYSTEM_UI, 14.0)
.default_attribute(TextAttribute::Weight(FontWeight::BOLD))
.text_color(
@ -679,7 +679,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, _env: &Env) {
if data.config.lapce.modal {
let text_layout = ctx
.text()
.new_text_layout("Modes".to_string())
.new_text_layout("Modes")
.font(FontFamily::SYSTEM_UI, 14.0)
.default_attribute(TextAttribute::Weight(FontWeight::BOLD))
.text_color(

View File

@ -493,9 +493,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &PaletteViewData, _env: &Env) {
&& data.palette.palette_type == PaletteType::SshHost
{
ctx.text()
.new_text_layout(
"Enter your SSH details, like user@host".to_string(),
)
.new_text_layout("Enter your SSH details, like user@host")
.font(FontFamily::SYSTEM_UI, 14.0)
.text_color(
data.config

View File

@ -357,13 +357,15 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) {
.get_color_unchecked(LapceTheme::EDITOR_BACKGROUND),
);
for (i, text) in ["Core Settings", "Editor Settings", "Keybindings"]
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.to_string())
.new_text_layout(*text)
.font(FontFamily::SYSTEM_UI, 14.0)
.text_color(
data.config
@ -393,7 +395,7 @@ fn paint(&mut self, ctx: &mut PaintCtx, data: &LapceTabData, env: &Env) {
);
let text_layout = ctx
.text()
.new_text_layout("Settings".to_string())
.new_text_layout("Settings")
.font(FontFamily::SYSTEM_UI, 16.0)
.text_color(
data.config