mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Replace try! with ?
This commit is contained in:
parent
0ff96c5ea9
commit
514751ff8a
@ -239,8 +239,8 @@ impl From<toml::de::Error> for Error {
|
||||
pub fn load_theme_file<P: AsRef<Path>>(filename: P) -> Result<Theme, Error> {
|
||||
let content = {
|
||||
let mut content = String::new();
|
||||
let mut file = try!(File::open(filename));
|
||||
try!(file.read_to_string(&mut content));
|
||||
let mut file = File::open(filename)?;
|
||||
file.read_to_string(&mut content)?;
|
||||
content
|
||||
};
|
||||
|
||||
|
@ -30,8 +30,7 @@ where
|
||||
|
||||
// We already have one byte, now read the others.
|
||||
for _ in 1..n_bytes {
|
||||
let byte =
|
||||
try!(next().ok_or_else(|| "Missing UTF-8 byte".to_string()));
|
||||
let byte = next().ok_or_else(|| "Missing UTF-8 byte".to_string())?;
|
||||
if byte & 0xC0 != 0x80 {
|
||||
return Err(format!(
|
||||
"Found non-continuation byte after leading: \
|
||||
|
Loading…
Reference in New Issue
Block a user