mirror of https://github.com/astral-sh/ruff
Remove unnecessary generic (#6923)
This commit is contained in:
parent
c2413dcd2c
commit
292fdd978e
|
|
@ -119,17 +119,17 @@ fn match_encoding_arg(arguments: &Arguments) -> Option<EncodingArg> {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return a [`Fix`] replacing the call to encode with a byte string.
|
/// 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,
|
locator: &Locator,
|
||||||
expr: &T,
|
call: &ast::ExprCall,
|
||||||
source_type: PySourceType,
|
source_type: PySourceType,
|
||||||
) -> Fix {
|
) -> Fix {
|
||||||
// Build up a replacement string by prefixing all string tokens with `b`.
|
// 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 replacement = String::with_capacity(contents.len() + 1);
|
||||||
let mut prev = expr.start();
|
let mut prev = call.start();
|
||||||
for (tok, range) in
|
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 {
|
match tok {
|
||||||
Tok::Dot => break,
|
Tok::Dot => break,
|
||||||
|
|
@ -148,7 +148,7 @@ fn replace_with_bytes_literal<T: Ranged>(
|
||||||
prev = range.end();
|
prev = range.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
Fix::automatic(Edit::range_replacement(replacement, expr.range()))
|
Fix::automatic(Edit::range_replacement(replacement, call.range()))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// UP012
|
/// UP012
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue