mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 10:22:24 +00:00
Remove unnecessary generic (#6923)
This commit is contained in:
parent
c2413dcd2c
commit
292fdd978e
1 changed files with 6 additions and 6 deletions
|
@ -119,17 +119,17 @@ fn match_encoding_arg(arguments: &Arguments) -> Option<EncodingArg> {
|
|||
}
|
||||
|
||||
/// Return a [`Fix`] replacing the call to encode with a byte string.
|
||||
fn replace_with_bytes_literal<T: Ranged>(
|
||||
fn replace_with_bytes_literal(
|
||||
locator: &Locator,
|
||||
expr: &T,
|
||||
call: &ast::ExprCall,
|
||||
source_type: PySourceType,
|
||||
) -> Fix {
|
||||
// Build up a replacement string by prefixing all string tokens with `b`.
|
||||
let contents = locator.slice(expr.range());
|
||||
let contents = locator.slice(call.range());
|
||||
let mut replacement = String::with_capacity(contents.len() + 1);
|
||||
let mut prev = expr.start();
|
||||
let mut prev = call.start();
|
||||
for (tok, range) in
|
||||
lexer::lex_starts_at(contents, source_type.as_mode(), expr.start()).flatten()
|
||||
lexer::lex_starts_at(contents, source_type.as_mode(), call.start()).flatten()
|
||||
{
|
||||
match tok {
|
||||
Tok::Dot => break,
|
||||
|
@ -148,7 +148,7 @@ fn replace_with_bytes_literal<T: Ranged>(
|
|||
prev = range.end();
|
||||
}
|
||||
|
||||
Fix::automatic(Edit::range_replacement(replacement, expr.range()))
|
||||
Fix::automatic(Edit::range_replacement(replacement, call.range()))
|
||||
}
|
||||
|
||||
/// UP012
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue