Nit: use last_mut better

This commit is contained in:
Niko Matsakis 2016-04-26 13:36:30 -04:00
parent 94841bea7b
commit 24f4b151b1

View File

@ -229,10 +229,9 @@ impl<S1,S2> From<(S1, Style, S2, Style, RenderedLineKind)> for RenderedLine
impl RenderedLine { impl RenderedLine {
fn trim_last(&mut self) { fn trim_last(&mut self) {
if !self.text.is_empty() { if let Some(last_text) = self.text.last_mut() {
let last_text = &mut self.text.last_mut().unwrap().text; let len = last_text.text.trim_right().len();
let len = last_text.trim_right().len(); last_text.text.truncate(len);
last_text.truncate(len);
} }
} }
} }