fn contains_exterior_struct_lit(value: &hir::Expr) -> bool {
            match value.node {
                hir::ExprStruct(..) => true,

                hir::ExprAssign(ref lhs, ref rhs) |
                hir::ExprAssignOp(_, ref lhs, ref rhs) |
                hir::ExprBinary(_, ref lhs, ref rhs) => {
                    // X { y: 1 } + X { y: 2 }
                    contains_exterior_struct_lit(&**lhs) ||
                        contains_exterior_struct_lit(&**rhs)
                }
                hir::ExprUnary(_, ref x) |
                hir::ExprCast(ref x, _) |
                hir::ExprField(ref x, _) |
                hir::ExprTupField(ref x, _) |
                hir::ExprIndex(ref x, _) => {
                    // &X { y: 1 }, X { y: 1 }.y
                    contains_exterior_struct_lit(&**x)
                }

                hir::ExprMethodCall(_, _, ref exprs) => {
                    // X { y: 1 }.bar(...)
                    contains_exterior_struct_lit(&*exprs[0])
                }

                _ => false
            }
        }
/// Expressions that syntactically contain an "exterior" struct
/// literal i.e. not surrounded by any parens or other
/// delimiters, e.g. `X { y: 1 }`, `X { y: 1 }.method()`, `foo
/// == X { y: 1 }` and `X { y: 1 } == foo` all do, but `(X {
/// y: 1 }) == foo` does not.
Expressions that syntactically contain an "exterior" struct
literal i.e. not surrounded by any parens or other
delimiters, e.g.
Expressions that syntactically contain an " exterior " struct literal i . e . not surrounded by any parens or other delimiters e . g .
fn contains_exterior_struct_lit(value: &hir::Expr) -> bool {
            match value.node {
                hir::ExprStruct(..) => true,
                hir::ExprAssign(ref lhs, ref rhs) |
                hir::ExprAssignOp(_, ref lhs, ref rhs) |
                hir::ExprBinary(_, ref lhs, ref rhs) => {
                    // X { y: 1 } + X { y: 2 }
                    contains_exterior_struct_lit(&**lhs) ||
                        contains_exterior_struct_lit(&**rhs)
                }
                hir::ExprUnary(_, ref x) |
                hir::ExprCast(ref x, _) |
                hir::ExprField(ref x, _) |
                hir::ExprTupField(ref x, _) |
                hir::ExprIndex(ref x, _) => {
                    // &X { y: 1 }, X { y: 1 }.y
                    contains_exterior_struct_lit(&**x)
                }
                hir::ExprMethodCall(_, _, ref exprs) => {
                    // X { y: 1 }.bar(...)
                    contains_exterior_struct_lit(&*exprs[0])
                }
                _ => false
            }
        }
fn contains_exterior_struct_lit ( value : & hir :: Expr ) -> bool { match value . node { hir :: ExprStruct ( .. ) => true , hir :: ExprAssign ( ref lhs , ref rhs ) | hir :: ExprAssignOp ( _ , ref lhs , ref rhs ) | hir :: ExprBinary ( _ , ref lhs , ref rhs ) => { // X { y: 1 } + X { y: 2 } contains_exterior_struct_lit ( & * * lhs ) || contains_exterior_struct_lit ( & * * rhs ) } hir :: ExprUnary ( _ , ref x ) | hir :: ExprCast ( ref x , _ ) | hir :: ExprField ( ref x , _ ) | hir :: ExprTupField ( ref x , _ ) | hir :: ExprIndex ( ref x , _ ) => { // &X { y: 1 }, X { y: 1 }.y contains_exterior_struct_lit ( & * * x ) } hir :: ExprMethodCall ( _ , _ , ref exprs ) => { // X { y: 1 }.bar(...) contains_exterior_struct_lit ( & * exprs [ 0 ] ) } _ => false } }
Expressions that syntactically contain an "exterior" struct
literal i.e.
Expressions that syntactically contain an " exterior " struct literal i . e .
value
&hir::Expr
value
&hir::Expr