lib: Fix compiler warnings

This commit is contained in:
Erik Kundt
2023-12-22 15:33:05 +01:00
parent a814e7d8ad
commit 668793a2ba
7 changed files with 17 additions and 14 deletions
+1 -1
View File
@@ -132,7 +132,7 @@ pub struct ContextBar {
}
impl ContextBar {
pub const PROP_EDIT_MODE: &str = "edit-mode";
pub const PROP_EDIT_MODE: &'static str = "edit-mode";
pub fn new(
theme: Theme,
+5 -5
View File
@@ -182,12 +182,12 @@ pub struct Form {
}
impl Form {
pub const CMD_FOCUS_PREVIOUS: &str = "cmd-focus-previous";
pub const CMD_FOCUS_NEXT: &str = "cmd-focus-next";
pub const CMD_NEWLINE: &str = "cmd-newline";
pub const CMD_PASTE: &str = "cmd-paste";
pub const CMD_FOCUS_PREVIOUS: &'static str = "cmd-focus-previous";
pub const CMD_FOCUS_NEXT: &'static str = "cmd-focus-next";
pub const CMD_NEWLINE: &'static str = "cmd-newline";
pub const CMD_PASTE: &'static str = "cmd-paste";
pub const PROP_ID: &str = "prop-id";
pub const PROP_ID: &'static str = "prop-id";
pub fn new(_theme: Theme, inputs: Vec<Box<dyn MockComponent>>) -> Self {
let state = FormState::new(Some(0), inputs.len());
+5 -2
View File
@@ -95,7 +95,7 @@ pub struct Textarea {
}
impl Textarea {
pub const PROP_DISPLAY_PROGRESS: &str = "display-progress";
pub const PROP_DISPLAY_PROGRESS: &'static str = "display-progress";
pub fn new(theme: Theme) -> Self {
Self {
@@ -163,7 +163,10 @@ impl WidgetComponent for Textarea {
self.len = body.len();
self.height = (layout[0].height - 1) as usize;
let body: String = body.iter().map(|line| format!("{}\n", line)).collect();
let body: String = body.iter().fold(String::new(), |mut body, line| {
body.push_str(&format!("{}\n", line));
body
});
let paragraph = Paragraph::new(body)
.scroll((self.offset as u16, 0))