Skip to content

Commit af53d5f

Browse files
committed
Rename
1 parent 81359af commit af53d5f

File tree

8 files changed

+12
-15
lines changed

8 files changed

+12
-15
lines changed

crates/ra_assists/src/ast_transform.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl<'a> SubstituteTypeParams<'a> {
8181
// FIXME: It would probably be nicer if we could get this via HIR (i.e. get the
8282
// trait ref, and then go from the types in the substs back to the syntax).
8383
fn get_syntactic_substs(impl_def: ast::Impl) -> Option<Vec<ast::Type>> {
84-
let target_trait = impl_def.target_trait()?;
84+
let target_trait = impl_def.trait_()?;
8585
let path_type = match target_trait {
8686
ast::Type::PathType(path) => path,
8787
_ => return None,

crates/ra_assists/src/utils.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,8 @@ pub(crate) fn resolve_target_trait(
111111
sema: &Semantics<RootDatabase>,
112112
impl_def: &ast::Impl,
113113
) -> Option<hir::Trait> {
114-
let ast_path = impl_def
115-
.target_trait()
116-
.map(|it| it.syntax().clone())
117-
.and_then(ast::PathType::cast)?
118-
.path()?;
114+
let ast_path =
115+
impl_def.trait_().map(|it| it.syntax().clone()).and_then(ast::PathType::cast)?.path()?;
119116

120117
match sema.resolve_path(&ast_path) {
121118
Some(hir::PathResolution::Def(hir::ModuleDef::Trait(def))) => Some(def),

crates/ra_hir_def/src/item_tree/lower.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,8 +448,8 @@ impl Ctx {
448448
fn lower_impl(&mut self, impl_def: &ast::Impl) -> Option<FileItemTreeId<Impl>> {
449449
let generic_params =
450450
self.lower_generic_params_and_inner_items(GenericsOwner::Impl, impl_def);
451-
let target_trait = impl_def.target_trait().map(|tr| self.lower_type_ref(&tr));
452-
let target_type = self.lower_type_ref(&impl_def.target_type()?);
451+
let target_trait = impl_def.trait_().map(|tr| self.lower_type_ref(&tr));
452+
let target_type = self.lower_type_ref(&impl_def.self_ty()?);
453453
let is_negative = impl_def.excl_token().is_some();
454454

455455
// We cannot use `assoc_items()` here as that does not include macro calls.

crates/ra_ide/src/display/navigation_target.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ impl ToNav for hir::ImplDef {
253253
let focus_range = if derive_attr.is_some() {
254254
None
255255
} else {
256-
src.value.target_type().map(|ty| original_range(db, src.with_value(ty.syntax())).range)
256+
src.value.self_ty().map(|ty| original_range(db, src.with_value(ty.syntax())).range)
257257
};
258258

259259
NavigationTarget::from_syntax(

crates/ra_ide/src/file_structure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,8 +130,8 @@ fn structure_node(node: &SyntaxNode) -> Option<StructureNode> {
130130
ast::Const(it) => decl_with_type_ref(&it, it.ty()),
131131
ast::Static(it) => decl_with_type_ref(&it, it.ty()),
132132
ast::Impl(it) => {
133-
let target_type = it.target_type()?;
134-
let target_trait = it.target_trait();
133+
let target_type = it.self_ty()?;
134+
let target_trait = it.trait_();
135135
let label = match target_trait {
136136
None => format!("impl {}", target_type.syntax().text()),
137137
Some(t) => {

crates/ra_ide/src/references/rename.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ fn text_edit_from_self_param(
194194
new_name: &str,
195195
) -> Option<TextEdit> {
196196
fn target_type_name(impl_def: &ast::Impl) -> Option<String> {
197-
if let Some(ast::Type::PathType(p)) = impl_def.target_type() {
197+
if let Some(ast::Type::PathType(p)) = impl_def.self_ty() {
198198
return Some(p.path()?.segment()?.name_ref()?.text().to_string());
199199
}
200200
None

crates/ra_syntax/src/ast/node_ext.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,14 @@ impl ast::UseTreeList {
136136
}
137137

138138
impl ast::Impl {
139-
pub fn target_type(&self) -> Option<ast::Type> {
139+
pub fn self_ty(&self) -> Option<ast::Type> {
140140
match self.target() {
141141
(Some(t), None) | (_, Some(t)) => Some(t),
142142
_ => None,
143143
}
144144
}
145145

146-
pub fn target_trait(&self) -> Option<ast::Type> {
146+
pub fn trait_(&self) -> Option<ast::Type> {
147147
match self.target() {
148148
(Some(t), Some(_)) => Some(t),
149149
_ => None,

crates/ra_syntax/src/validation.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ fn validate_visibility(vis: ast::Visibility, errors: &mut Vec<SyntaxError>) {
208208
Some(it) => it,
209209
None => return,
210210
};
211-
if impl_def.target_trait().is_some() {
211+
if impl_def.trait_().is_some() {
212212
errors.push(SyntaxError::new("Unnecessary visibility qualifier", vis.syntax.text_range()));
213213
}
214214
}

0 commit comments

Comments
 (0)