mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-11 06:08:03 +00:00
Reduce Result<Tok, LexicalError>
size by using Box<str>
instead of String
(#9885)
This commit is contained in:
parent
9027169125
commit
fe7d965334
22 changed files with 454 additions and 425 deletions
|
@ -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)?;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue