File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
nix-script-directives/src Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ impl FromStr for Expr {
88
88
}
89
89
}
90
90
91
- /// Unwrap parentheses.
91
+ /// Unwrap parentheses when converting from a [`SyntaxNode`] .
92
92
impl From < SyntaxNode > for Expr {
93
93
fn from ( outer : SyntaxNode ) -> Expr {
94
94
if outer. kind ( ) == SyntaxKind :: NODE_PAREN {
@@ -141,23 +141,17 @@ mod tests {
141
141
142
142
#[ test]
143
143
fn unwraps_root ( ) {
144
- assert_eq ! ( SyntaxKind :: NODE_IDENT , Expr :: from_str( "a" ) . unwrap( ) . kind ( ) )
144
+ assert ! ( Expr :: from_str( "a" ) . unwrap( ) . is_leaf ( ) )
145
145
}
146
146
147
147
#[ test]
148
148
fn unwraps_parens ( ) {
149
- assert_eq ! (
150
- SyntaxKind :: NODE_IDENT ,
151
- Expr :: from_str( "(a)" ) . unwrap( ) . kind( )
152
- )
149
+ assert ! ( Expr :: from_str( "(a)" ) . unwrap( ) . is_leaf( ) )
153
150
}
154
151
155
152
#[ test]
156
153
fn unwraps_all_parens ( ) {
157
- assert_eq ! (
158
- SyntaxKind :: NODE_IDENT ,
159
- Expr :: from_str( "((a))" ) . unwrap( ) . kind( )
160
- )
154
+ assert ! ( Expr :: from_str( "((a))" ) . unwrap( ) . is_leaf( ) )
161
155
}
162
156
}
163
157
You can’t perform that action at this time.
0 commit comments