Repository navigation
Support ? mark in nightlies as alternative to try! #867
Description
Activity
Should be behind an option until
?is stable.This is behind the
question_marklang feature.- added a commit that references this issue
on Mar 29, 2016 This makes method chain formatting a bit more complex. Looking into this.
Should be behind an option until
?is stable.Shouldn't we format code that uses it? Or use the
#![feature(question_mark)]as a mark that the code is opting in.Yea, I don't think it needs to be behind an option either.
Having written that, I realize that if we are formatting individual files, we'd also have to find the crate root to see what features are in use. I kind of lean towards just accepting it unconditionally anyway.
Reacted by 0x0GMe too.
To clarify I meant that there should be an option which changes
try!(expr)toexpr?. Just formattingexpr?doesn't need to be behind an option,Reacted by Kamal Al MarhubiPinging that issue,
rustfmtproduces weird diffs on Clippy:@@ -57,11 +57,11 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> { for a in a { if let ExprBinary(binop, ref lhs, ref rhs) = a.node { if binop.node == op { - v = self.extract(op, &[lhs, rhs], v)?; + v = self.extract(op, &[lhs, rhs], v)?;; continue; } } - v.push(self.run(a)?); + v.push(self.run(a)?)); } Ok(v) } @@ -70,22 +70,22 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> { // prevent folding of `cfg!` macros and the like if !in_macro(self.cx, e.span) { match e.node { - ExprUnary(UnNot, ref inner) => return Ok(Bool::Not(box self.run(inner)?)), + ExprUnary(UnNot, ref inner) => return Ok(Bool::Not(box self.run(inner)?))), ExprBinary(binop, ref lhs, ref rhs) => { match binop.node { - BiOr => return Ok(Bool::Or(self.extract(BiOr, &[lhs, rhs], Vec::new())?)), - BiAnd => return Ok(Bool::And(self.extract(BiAnd, &[lhs, rhs], Vec::new())?)), - _ => {}, + BiOr => return Ok(Bool::Or(self.extract(BiOr, &[lhs, rhs], Vec::new())?))), + BiAnd => return Ok(Bool::And(self.extract(BiAnd, &[lhs, rhs], Vec::new())?))),
@marcusklaas didn’t see that PR, just tested with it, works as expected 👍
Closed by #893.