mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-22 20:45:11 +00:00
Rename as_str
to to_str
(#8886)
This PR renames the method on `StringLiteralValue` from `as_str` to `to_str`. The main motivation is to follow the naming convention as described in the [Rust API Guidelines](https://rust-lang.github.io/api-guidelines/naming.html#ad-hoc-conversions-follow-as_-to_-into_-conventions-c-conv). This method can perform a string allocation in case the string is implicitly concatenated.
This commit is contained in:
parent
b28556d739
commit
ec7456bac0
38 changed files with 68 additions and 68 deletions
|
@ -1356,7 +1356,7 @@ impl<'a> Generator<'a> {
|
|||
fn unparse_f_string_elem(&mut self, expr: &Expr, is_spec: bool) {
|
||||
match expr {
|
||||
Expr::StringLiteral(ast::ExprStringLiteral { value, .. }) => {
|
||||
self.unparse_f_string_literal(value.as_str());
|
||||
self.unparse_f_string_literal(value.to_str());
|
||||
}
|
||||
Expr::FString(ast::ExprFString { value, .. }) => {
|
||||
self.unparse_f_string_value(value, is_spec);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue