Skip to content

Support ? mark in nightlies as alternative to try! #867

Description

@tupshin
No description provided.

Activity

  1. nrc commented on Mar 14, 2016

    @nrc
    Member

    Should be behind an option until ? is stable.

  2. kamalmarhubi commented on Mar 29, 2016

    @kamalmarhubi
    Contributor

    This is behind the question_mark lang feature.

  3. self-assigned this
    on Mar 29, 2016
  4. marcusklaas commented on Mar 29, 2016

    @marcusklaas
    Contributor

    This makes method chain formatting a bit more complex. Looking into this.

  5. kamalmarhubi commented on Mar 29, 2016

    @kamalmarhubi
    Contributor

    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.

  6. marcusklaas commented on Mar 29, 2016

    @marcusklaas
    Contributor

    Yea, I don't think it needs to be behind an option either.

  7. kamalmarhubi commented on Mar 29, 2016

    @kamalmarhubi
    Contributor

    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.

  8. marcusklaas commented on Mar 29, 2016

    @marcusklaas
    Contributor

    Me too.

  9. nrc commented on Apr 4, 2016

    @nrc
    Member

    To clarify I meant that there should be an option which changes try!(expr) to expr?. Just formatting expr? doesn't need to be behind an option,

  10. added this to the milestone on Apr 6, 2016
  11. mcarton commented on Apr 14, 2016

    @mcarton

    Pinging that issue, rustfmt produces 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())?))),
  12. marcusklaas commented on Apr 14, 2016

    @marcusklaas
    Contributor

    @mcarton: is that on the master branch, or using #893?

    Edit: either way, it's a bug in the rustc parser that has been fixed, but is still in syntex.

  13. mcarton commented on Apr 14, 2016

    @mcarton

    @marcusklaas didn’t see that PR, just tested with it, works as expected 👍

  14. marcusklaas commented on May 13, 2016

    @marcusklaas
    Contributor

    Closed by #893.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions