Fixes error on propagating a Result<()> with the ? operator

This commit is contained in:
rep-nop
2017-02-26 00:14:05 -05:00
committed by Jakob Stoklund Olesen
parent 7edbc90d5e
commit 077f39d8da

View File

@@ -117,7 +117,9 @@ impl Configurable for Builder {
let (offset, detail) = self.lookup(name)?; let (offset, detail) = self.lookup(name)?;
match detail { match detail {
Detail::Bool { bit } => { Detail::Bool { bit } => {
self.set_bit(offset, bit, parse_bool_value(value))?; // Cannot currently propagate Result<()> up on functions returning ()
// with the `?` operator
self.set_bit(offset, bit, parse_bool_value(value)?);
} }
Detail::Num => { Detail::Num => {
self.bytes[offset] = value.parse().map_err(|_| Error::BadValue)?; self.bytes[offset] = value.parse().map_err(|_| Error::BadValue)?;