mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 21:13:37 +00:00
don't to_string() format args
This commit is contained in:
parent
b22bd36f6e
commit
196650dfaf
6 changed files with 13 additions and 23 deletions
|
@ -386,7 +386,7 @@ impl MirEvalError {
|
|||
write!(
|
||||
f,
|
||||
"Layout for type `{}` is not available due {err:?}",
|
||||
ty.display(db).with_closure_style(ClosureStyle::ClosureWithId).to_string()
|
||||
ty.display(db).with_closure_style(ClosureStyle::ClosureWithId)
|
||||
)?;
|
||||
}
|
||||
MirEvalError::MirLowerError(func, err) => {
|
||||
|
|
|
@ -177,7 +177,7 @@ impl MirLowerError {
|
|||
)?;
|
||||
writeln!(f, "Provided args: [")?;
|
||||
for g in subst.iter(Interner) {
|
||||
write!(f, " {},", g.display(db).to_string())?;
|
||||
write!(f, " {},", g.display(db))?;
|
||||
}
|
||||
writeln!(f, "]")?;
|
||||
}
|
||||
|
|
|
@ -266,11 +266,8 @@ fn generate_impl(
|
|||
.clone_for_update();
|
||||
|
||||
// Goto link : https://doc.rust-lang.org/reference/paths.html#qualified-paths
|
||||
let qualified_path_type = make::path_from_text(&format!(
|
||||
"<{} as {}>",
|
||||
field_ty.to_string(),
|
||||
delegate.trait_()?.to_string()
|
||||
));
|
||||
let qualified_path_type =
|
||||
make::path_from_text(&format!("<{} as {}>", field_ty, delegate.trait_()?));
|
||||
|
||||
let delegate_assoc_items = delegate.get_or_create_assoc_item_list();
|
||||
match bound_def.assoc_item_list() {
|
||||
|
@ -373,11 +370,8 @@ fn generate_impl(
|
|||
.clone_for_update();
|
||||
|
||||
// Goto link : https://doc.rust-lang.org/reference/paths.html#qualified-paths
|
||||
let qualified_path_type = make::path_from_text(&format!(
|
||||
"<{} as {}>",
|
||||
field_ty.to_string(),
|
||||
delegate.trait_()?.to_string()
|
||||
));
|
||||
let qualified_path_type =
|
||||
make::path_from_text(&format!("<{} as {}>", field_ty, delegate.trait_()?));
|
||||
|
||||
// 4) Transform associated items in delegte trait impl
|
||||
let delegate_assoc_items = delegate.get_or_create_assoc_item_list();
|
||||
|
@ -759,7 +753,7 @@ fn ty_assoc_item(item: syntax::ast::TypeAlias, qual_path_ty: Path) -> Option<Ass
|
|||
}
|
||||
|
||||
fn qualified_path(qual_path_ty: ast::Path, path_expr_seg: ast::Path) -> ast::Path {
|
||||
make::path_from_text(&format!("{}::{}", qual_path_ty.to_string(), path_expr_seg.to_string()))
|
||||
make::path_from_text(&format!("{}::{}", qual_path_ty, path_expr_seg))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -105,7 +105,7 @@ pub(crate) fn generate_mut_trait_impl(acc: &mut Assists, ctx: &AssistContext<'_>
|
|||
"Generate `IndexMut` impl from this `Index` trait",
|
||||
target,
|
||||
|edit| {
|
||||
edit.insert(target.start(), format!("$0{}\n\n", impl_def.to_string()));
|
||||
edit.insert(target.start(), format!("$0{}\n\n", impl_def));
|
||||
},
|
||||
)
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ pub(crate) fn generate_trait_from_impl(acc: &mut Assists, ctx: &AssistContext<'_
|
|||
builder.replace_snippet(
|
||||
snippet_cap,
|
||||
impl_name.syntax().text_range(),
|
||||
format!("${{0:TraitName}}{} for {}", arg_list, impl_name.to_string()),
|
||||
format!("${{0:TraitName}}{} for {}", arg_list, impl_name),
|
||||
);
|
||||
|
||||
// Insert trait before TraitImpl
|
||||
|
@ -144,17 +144,13 @@ pub(crate) fn generate_trait_from_impl(acc: &mut Assists, ctx: &AssistContext<'_
|
|||
} else {
|
||||
builder.replace(
|
||||
impl_name.syntax().text_range(),
|
||||
format!("NewTrait{} for {}", arg_list, impl_name.to_string()),
|
||||
format!("NewTrait{} for {}", arg_list, impl_name),
|
||||
);
|
||||
|
||||
// Insert trait before TraitImpl
|
||||
builder.insert(
|
||||
impl_ast.syntax().text_range().start(),
|
||||
format!(
|
||||
"{}\n\n{}",
|
||||
trait_ast.to_string(),
|
||||
IndentLevel::from_node(impl_ast.syntax())
|
||||
),
|
||||
format!("{}\n\n{}", trait_ast, IndentLevel::from_node(impl_ast.syntax())),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ pub(crate) fn trait_impl_redundant_assoc_item(
|
|||
.source(db)
|
||||
.map(|it| it.syntax().value.text_range())
|
||||
.unwrap_or(default_range),
|
||||
format!("\n {};", function.display(db).to_string()),
|
||||
format!("\n {};", function.display(db)),
|
||||
)
|
||||
}
|
||||
hir::AssocItem::Const(id) => {
|
||||
|
@ -43,7 +43,7 @@ pub(crate) fn trait_impl_redundant_assoc_item(
|
|||
.source(db)
|
||||
.map(|it| it.syntax().value.text_range())
|
||||
.unwrap_or(default_range),
|
||||
format!("\n {};", constant.display(db).to_string()),
|
||||
format!("\n {};", constant.display(db)),
|
||||
)
|
||||
}
|
||||
hir::AssocItem::TypeAlias(id) => {
|
||||
|
|
Loading…
Reference in a new issue