mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-19 02:55:20 +00:00
Implement Ranged
on more structs (#6639)
## Summary I noticed some inconsistencies around uses of `.range.start()`, structs that have a `TextRange` field but don't implement `Ranged`, etc. ## Test Plan `cargo test`
This commit is contained in:
parent
a70807e1e1
commit
db1c556508
66 changed files with 221 additions and 176 deletions
|
@ -66,7 +66,7 @@ pub(crate) fn validate_pos_params(
|
|||
if let Some(invalid) = first_invalid {
|
||||
return Err(LexicalError {
|
||||
error: LexicalErrorType::DefaultArgumentError,
|
||||
location: invalid.parameter.range.start(),
|
||||
location: invalid.parameter.start(),
|
||||
});
|
||||
}
|
||||
Ok(())
|
||||
|
|
|
@ -318,9 +318,8 @@ impl<'a> StringParser<'a> {
|
|||
)
|
||||
})?;
|
||||
let leading =
|
||||
&expression[..usize::from(value.range().start() - start_location) - 1];
|
||||
let trailing =
|
||||
&expression[usize::from(value.range().end() - start_location) - 1..];
|
||||
&expression[..usize::from(value.start() - start_location) - 1];
|
||||
let trailing = &expression[usize::from(value.end() - start_location) - 1..];
|
||||
vec![Expr::from(ast::ExprFormattedValue {
|
||||
value: Box::new(value),
|
||||
debug_text: Some(ast::DebugText {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue