1- // Napi value need to be passed as value
2- #![ expect( clippy:: needless_pass_by_value) ]
3-
41#[ cfg( all(
52 feature = "allocator" ,
63 not( any( target_arch = "arm" , target_os = "freebsd" , target_family = "wasm" ) )
@@ -87,13 +84,13 @@ fn parse_impl<'a>(
8784 . parse ( )
8885}
8986
90- fn parse_with_return ( filename : & str , source_text : String , options : & ParserOptions ) -> ParseResult {
87+ fn parse_with_return ( filename : & str , source_text : & str , options : & ParserOptions ) -> ParseResult {
9188 let allocator = Allocator :: default ( ) ;
9289 let source_type =
9390 get_source_type ( filename, options. lang . as_deref ( ) , options. source_type . as_deref ( ) ) ;
9491 let ast_type = get_ast_type ( source_type, options) ;
9592 let ranges = options. range . unwrap_or ( false ) ;
96- let ret = parse_impl ( & allocator, source_type, & source_text, options) ;
93+ let ret = parse_impl ( & allocator, source_type, source_text, options) ;
9794
9895 let mut program = ret. program ;
9996 let mut module_record = ret. module_record ;
@@ -104,10 +101,10 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption
104101 diagnostics. extend ( semantic_ret. errors ) ;
105102 }
106103
107- let mut errors = OxcError :: from_diagnostics ( filename, & source_text, diagnostics) ;
104+ let mut errors = OxcError :: from_diagnostics ( filename, source_text, diagnostics) ;
108105
109106 let mut comments =
110- convert_utf8_to_utf16 ( & source_text, & mut program, & mut module_record, & mut errors) ;
107+ convert_utf8_to_utf16 ( source_text, & mut program, & mut module_record, & mut errors) ;
111108
112109 let program_and_fixes = match ast_type {
113110 AstType :: JavaScript => {
@@ -142,13 +139,14 @@ fn parse_with_return(filename: &str, source_text: String, options: &ParserOption
142139
143140/// Parse synchronously.
144141#[ napi]
142+ #[ allow( clippy:: needless_pass_by_value, clippy:: allow_attributes) ]
145143pub fn parse_sync (
146144 filename : String ,
147145 source_text : String ,
148146 options : Option < ParserOptions > ,
149147) -> ParseResult {
150148 let options = options. unwrap_or_default ( ) ;
151- parse_with_return ( & filename, source_text, & options)
149+ parse_with_return ( & filename, & source_text, & options)
152150}
153151
154152pub struct ResolveTask {
@@ -164,7 +162,7 @@ impl Task for ResolveTask {
164162
165163 fn compute ( & mut self ) -> napi:: Result < Self :: Output > {
166164 let source_text = mem:: take ( & mut self . source_text ) ;
167- Ok ( parse_with_return ( & self . filename , source_text, & self . options ) )
165+ Ok ( parse_with_return ( & self . filename , & source_text, & self . options ) )
168166 }
169167
170168 fn resolve ( & mut self , _: napi:: Env , result : Self :: Output ) -> napi:: Result < Self :: JsValue > {
0 commit comments