cleaning up with match per suggestion

This commit is contained in:
Martin Lariz 2020-07-30 12:17:25 -07:00 committed by Ferran Basora
parent f4696faf77
commit 0e04276056

View File

@ -125,14 +125,11 @@ impl<'a> View<'a> {
);
if let Some(ref hint) = mat.hint {
let extra_position = if self.position == "left" {
0
} else if self.position == "off_left" {
0 - mat.hint.clone().unwrap().len()
} else if self.position == "off_right" {
text.len()
} else {
text.len() - mat.hint.clone().unwrap().len()
let extra_position = match self.position {
"right" => text.len() - mat.hint.clone().unwrap().len(),
"off_left" => 0 - mat.hint.clone().unwrap().len(),
"off_right" => text.len(),
_ => 0,
};
let text = self.make_hint_text(hint.as_str());