Skip to content

Commit

Permalink
trim list line, replace GString with String, allow empty value
Browse files Browse the repository at this point in the history
  • Loading branch information
yggverse committed Dec 3, 2024
1 parent c6f747f commit 4741365
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/line/list.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use glib::{GString, Regex, RegexCompileFlags, RegexMatchFlags};
use glib::{Regex, RegexCompileFlags, RegexMatchFlags};

pub struct List {
pub value: GString,
pub value: String,
}

impl List {
Expand All @@ -15,15 +15,11 @@ impl List {
);

// Detect value
let value = regex.get(1)?;

if value.trim().is_empty() {
return None;
}
let value = regex.get(1)?.trim();

// Result
Some(Self {
value: GString::from(value.as_str()),
value: String::from(value),
})
}
}

0 comments on commit 4741365

Please sign in to comment.