Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-expand/src/builtin/derive_macro.rs')
-rw-r--r--crates/hir-expand/src/builtin/derive_macro.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/crates/hir-expand/src/builtin/derive_macro.rs b/crates/hir-expand/src/builtin/derive_macro.rs
index 5e85a710e0..63e5764728 100644
--- a/crates/hir-expand/src/builtin/derive_macro.rs
+++ b/crates/hir-expand/src/builtin/derive_macro.rs
@@ -412,7 +412,7 @@ fn name_to_token(
})?;
let span = token_map.span_at(name.syntax().text_range().start());
- let name_token = tt::Ident::new(name.text().as_ref(), span);
+ let name_token = tt::Ident::new(name.text(), span);
Ok(name_token)
}
@@ -1184,7 +1184,7 @@ fn coerce_pointee_expand(
let new_bounds = bounds.bounds().filter_map(|bound| {
let new_bound = substitute_type_bound(
bound.clone(),
- &pointee_param_name.text(),
+ pointee_param_name.text(),
ADDED_PARAM,
);
@@ -1197,7 +1197,7 @@ fn coerce_pointee_expand(
let new_bounds_target = if is_pointee {
make.name_ref(ADDED_PARAM)
} else {
- make.name_ref(&param_name.text())
+ make.name_ref(param_name.text())
};
new_predicates.push(make.where_pred(
Either::Right(
@@ -1240,12 +1240,12 @@ fn coerce_pointee_expand(
// If the target type references the pointee, duplicate the bound as whole.
// Otherwise, duplicate only bounds that mention the pointee.
if let Some(predicate_with_substituted_target) =
- substitute_where_pred(&predicate, &pointee_param_name.text(), ADDED_PARAM)
+ substitute_where_pred(&predicate, pointee_param_name.text(), ADDED_PARAM)
{
new_predicates.push(predicate_with_substituted_target);
} else if let Some(bounds) = predicate.type_bound_list() {
let new_bounds = bounds.bounds().filter_map(|bound| {
- substitute_type_bound(bound, &pointee_param_name.text(), ADDED_PARAM)
+ substitute_type_bound(bound, pointee_param_name.text(), ADDED_PARAM)
});
new_predicates.push(make.where_pred(Either::Right(pred_target), new_bounds));
}
@@ -1259,7 +1259,7 @@ fn coerce_pointee_expand(
new_predicates.push(
make.where_pred(
Either::Right(make.ty_path_from_segments(
- [make.path_segment(make.name_ref(&pointee_param_name.text()))],
+ [make.path_segment(make.name_ref(pointee_param_name.text()))],
false,
)),
[make.type_bound(
@@ -1294,7 +1294,7 @@ fn coerce_pointee_expand(
.filter_map(|param| {
Some(match param {
ast::GenericParam::ConstParam(param) => {
- ast::GenericArg::ConstArg(make.expr_const_value(&param.name()?.text()))
+ ast::GenericArg::ConstArg(make.expr_const_value(param.name()?.text()))
}
ast::GenericParam::LifetimeParam(param) => {
make.lifetime_arg(param.lifetime()?).into()
@@ -1303,7 +1303,7 @@ fn coerce_pointee_expand(
let name = if pointee_param_idx == type_param_idx {
make.name_ref(ADDED_PARAM)
} else {
- make.name_ref(&param.name()?.text())
+ make.name_ref(param.name()?.text())
};
type_param_idx += 1;
make.type_arg(make.ty_path_from_segments([make.path_segment(name)], false))
@@ -1314,7 +1314,7 @@ fn coerce_pointee_expand(
make.path_from_segments(
[make.generic_ty_path_segment(
- make.name_ref(&struct_name.text()),
+ make.name_ref(struct_name.text()),
self_params_for_traits,
)],
false,