mirror of
https://github.com/orhun/systeroid
synced 2024-07-23 19:34:58 +00:00
refactor(lint): remove trim before splitting by whitespace
This commit is contained in:
parent
8c2862caae
commit
16dd491d4c
|
@ -47,17 +47,14 @@ impl FromStr for Command {
|
||||||
"exit" | "quit" | "q" | "q!" => Ok(Command::Exit),
|
"exit" | "quit" | "q" | "q!" => Ok(Command::Exit),
|
||||||
_ => {
|
_ => {
|
||||||
if s.starts_with("set") {
|
if s.starts_with("set") {
|
||||||
let values: Vec<&str> = s
|
let values: Vec<&str> =
|
||||||
.trim_start_matches("set")
|
s.trim_start_matches("set").split_whitespace().collect();
|
||||||
.trim()
|
|
||||||
.split_whitespace()
|
|
||||||
.collect();
|
|
||||||
Ok(Command::Set(
|
Ok(Command::Set(
|
||||||
values.first().ok_or(())?.to_string(),
|
values.first().ok_or(())?.to_string(),
|
||||||
values[1..].join(" "),
|
values[1..].join(" "),
|
||||||
))
|
))
|
||||||
} else if s.starts_with("scroll") {
|
} else if s.starts_with("scroll") {
|
||||||
let mut values = s.trim_start_matches("scroll").trim().split_whitespace();
|
let mut values = s.trim_start_matches("scroll").split_whitespace();
|
||||||
Ok(Command::Scroll(
|
Ok(Command::Scroll(
|
||||||
ScrollArea::try_from(values.next().ok_or(())?)?,
|
ScrollArea::try_from(values.next().ok_or(())?)?,
|
||||||
Direction::try_from(values.next().ok_or(())?)?,
|
Direction::try_from(values.next().ok_or(())?)?,
|
||||||
|
|
Loading…
Reference in a new issue