@@ -1023,8 +1023,6 @@ impl Parser<Expr> for ExpressionParser {
10231023
10241024#[ cfg( test) ]
10251025mod tests {
1026- #![ expect( clippy:: unwrap_used) ]
1027-
10281026 use crate :: core:: parser:: components:: expressions:: ExpressionParser ;
10291027 use crate :: core:: parser:: components:: helpers:: {
10301028 extract_doc_text, parse_leading_docs,
@@ -1442,7 +1440,7 @@ mod tests {
14421440 end_col : u32 ,
14431441 ) -> Token {
14441442 Token :: new (
1445- TokenType :: DocComment ( format ! ( "///{ text}" ) ) ,
1443+ TokenType :: DocComment ( text. to_string ( ) ) ,
14461444 ( line, start_col) ,
14471445 ( line, end_col) ,
14481446 )
@@ -1639,9 +1637,10 @@ mod tests {
16391637 assert ! ( result. is_some( ) ) ;
16401638 let docs = result. unwrap ( ) ;
16411639 assert_eq ! ( docs. lines. len( ) , 3 ) ;
1642- assert_eq ! ( docs. lines[ 0 ] , "" ) ; // Trimmed to empty
1640+ // Only a single leading space is removed; remaining spaces preserved
1641+ assert_eq ! ( docs. lines[ 0 ] , " " ) ;
16431642 assert_eq ! ( docs. lines[ 1 ] , "Real content" ) ;
1644- assert_eq ! ( docs. lines[ 2 ] , "" ) ; // Trimmed to empty
1643+ assert_eq ! ( docs. lines[ 2 ] , " " ) ;
16451644 }
16461645
16471646 #[ test]
@@ -1701,7 +1700,7 @@ mod tests {
17011700 #[ test]
17021701 fn extract_doc_text_with_prefix ( ) {
17031702 let token = Token :: new (
1704- TokenType :: DocComment ( "/// This is documentation" . to_string ( ) ) ,
1703+ TokenType :: DocComment ( " This is documentation" . to_string ( ) ) ,
17051704 ( 1 , 1 ) ,
17061705 ( 1 , 25 ) ,
17071706 ) ;
@@ -1725,13 +1724,14 @@ mod tests {
17251724 #[ test]
17261725 fn extract_doc_text_with_extra_whitespace ( ) {
17271726 let token = Token :: new (
1728- TokenType :: DocComment ( "/// This has extra spaces " . to_string ( ) ) ,
1727+ TokenType :: DocComment ( " This has extra spaces " . to_string ( ) ) ,
17291728 ( 1 , 1 ) ,
17301729 ( 1 , 31 ) ,
17311730 ) ;
17321731
17331732 let result = extract_doc_text ( & token) ;
1734- assert_eq ! ( result, Some ( "This has extra spaces" . to_string( ) ) ) ;
1733+ // Only a single leading space is removed; preserve the rest
1734+ assert_eq ! ( result, Some ( " This has extra spaces " . to_string( ) ) ) ;
17351735 }
17361736
17371737 #[ test]
@@ -1750,17 +1750,17 @@ mod tests {
17501750 fn docs_span_calculation ( ) {
17511751 let tokens = vec ! [
17521752 Token :: new(
1753- TokenType :: DocComment ( "/// First" . to_string( ) ) ,
1753+ TokenType :: DocComment ( " First" . to_string( ) ) ,
17541754 ( 1 , 1 ) ,
17551755 ( 1 , 10 ) ,
17561756 ) ,
17571757 Token :: new(
1758- TokenType :: DocComment ( "/// Second" . to_string( ) ) ,
1758+ TokenType :: DocComment ( " Second" . to_string( ) ) ,
17591759 ( 2 , 1 ) ,
17601760 ( 2 , 11 ) ,
17611761 ) ,
17621762 Token :: new(
1763- TokenType :: DocComment ( "/// Third" . to_string( ) ) ,
1763+ TokenType :: DocComment ( " Third" . to_string( ) ) ,
17641764 ( 3 , 1 ) ,
17651765 ( 3 , 10 ) ,
17661766 ) ,
0 commit comments