Skip to content

Commit 96b11ff

Browse files
committed
avoid unnecessary copy
1 parent 2a2db33 commit 96b11ff

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/parser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,14 +1385,14 @@ class CJSLexer {
13851385
}
13861386
};
13871387

1388-
std::optional<lexer_analysis> parse_commonjs(const std::string_view file_contents) {
1388+
std::optional<lexer_analysis> parse_commonjs(std::string_view file_contents) {
13891389
last_error.reset();
13901390

13911391
lexer_analysis result;
13921392
CJSLexer lexer(result.exports, result.re_exports);
13931393

13941394
if (lexer.parse(file_contents)) {
1395-
return result;
1395+
return result; // NRVO or implicit move applies
13961396
}
13971397

13981398
return std::nullopt;

0 commit comments

Comments
 (0)