Reduce Result<Tok, LexicalError> size by using Box<str> instead of String (#9885)

This commit is contained in:
Micha Reiser 2024-02-08 21:36:22 +01:00 committed by GitHub
parent 9027169125
commit fe7d965334
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
22 changed files with 454 additions and 425 deletions

View file

@ -134,8 +134,8 @@ pub fn format_module_source(
let source_type = options.source_type();
let (tokens, comment_ranges) =
tokens_and_ranges(source, source_type).map_err(|err| ParseError {
offset: err.location,
error: ParseErrorType::Lexical(err.error),
offset: err.location(),
error: ParseErrorType::Lexical(err.into_error()),
})?;
let module = parse_tokens(tokens, source, source_type.as_mode())?;
let formatted = format_module_ast(&module, &comment_ranges, source, options)?;

View file

@ -73,8 +73,8 @@ pub fn format_range(
let (tokens, comment_ranges) =
tokens_and_ranges(source, options.source_type()).map_err(|err| ParseError {
offset: err.location,
error: ParseErrorType::Lexical(err.error),
offset: err.location(),
error: ParseErrorType::Lexical(err.into_error()),
})?;
assert_valid_char_boundaries(range, source);