Converts all try! macros to ? syntax.

Fixes #46
This commit is contained in:
rep-nop
2017-02-25 22:12:33 -05:00
committed by Jakob Stoklund Olesen
parent cf5701b137
commit b23f1fb347
22 changed files with 270 additions and 270 deletions

View File

@@ -171,13 +171,13 @@ def gen_display(sgrp, fmt):
with fmt.indented(
'fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {',
'}'):
fmt.line('try!(writeln!(f, "[{}]"));'.format(sgrp.name))
fmt.line('writeln!(f, "[{}]")?;'.format(sgrp.name))
with fmt.indented('for d in &DESCRIPTORS {', '}'):
fmt.line('try!(write!(f, "{} = ", d.name));')
fmt.line('write!(f, "{} = ", d.name)?;')
fmt.line(
'try!(TEMPLATE.format_toml_value(d.detail,' +
'self.bytes[d.offset as usize], f));')
fmt.line('try!(writeln!(f, ""));')
'TEMPLATE.format_toml_value(d.detail,' +
'self.bytes[d.offset as usize], f)?;')
fmt.line('writeln!(f, "")?;')
fmt.line('Ok(())')