Run rustfmt and replace depricated try!() macro with ? operator.
No functional changes.
This commit is contained in:
parent
f0a44ab300
commit
9cadb9bd8c
|
@ -44,7 +44,7 @@ impl Buffer {
|
||||||
|
|
||||||
pub fn new_from_file(path: &Path) -> io::Result<Buffer> {
|
pub fn new_from_file(path: &Path) -> io::Result<Buffer> {
|
||||||
let buf = Buffer {
|
let buf = Buffer {
|
||||||
text: Rope::from_reader(BufReader::new(try!(File::open(path))))?,
|
text: Rope::from_reader(BufReader::new(File::open(path)?))?,
|
||||||
file_path: Some(path.to_path_buf()),
|
file_path: Some(path.to_path_buf()),
|
||||||
undo_stack: UndoStack::new(),
|
undo_stack: UndoStack::new(),
|
||||||
};
|
};
|
||||||
|
@ -53,7 +53,7 @@ impl Buffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn save_to_file(&self, path: &Path) -> io::Result<()> {
|
pub fn save_to_file(&self, path: &Path) -> io::Result<()> {
|
||||||
let mut f = BufWriter::new(try!(File::create(path)));
|
let mut f = BufWriter::new(File::create(path)?);
|
||||||
|
|
||||||
for c in self.text.chunks() {
|
for c in self.text.chunks() {
|
||||||
let _ = f.write(c.as_bytes());
|
let _ = f.write(c.as_bytes());
|
||||||
|
@ -1482,5 +1482,4 @@ mod tests {
|
||||||
|
|
||||||
assert!(None == iter.next());
|
assert!(None == iter.next());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,8 @@ impl Drop for Screen {
|
||||||
color::Fg(color::Reset),
|
color::Fg(color::Reset),
|
||||||
color::Bg(color::Reset),
|
color::Bg(color::Reset),
|
||||||
termion::clear::All,
|
termion::clear::All,
|
||||||
).unwrap();
|
)
|
||||||
|
.unwrap();
|
||||||
self.show_cursor();
|
self.show_cursor();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user