diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir/src/display.rs | 2 | ||||
-rw-r--r-- | crates/hir/src/lib.rs | 4 | ||||
-rw-r--r-- | crates/ide/src/runnables.rs | 6 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/extract_function.rs | 2 | ||||
-rw-r--r-- | crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs | 2 | ||||
-rw-r--r-- | crates/ide_assists/src/utils/suggest_name.rs | 2 | ||||
-rw-r--r-- | crates/ide_completion/src/context.rs | 4 | ||||
-rw-r--r-- | crates/ide_completion/src/render/enum_variant.rs | 2 |
8 files changed, 12 insertions, 12 deletions
diff --git a/crates/hir/src/display.rs b/crates/hir/src/display.rs index 01a4d205f..508ac37c2 100644 --- a/crates/hir/src/display.rs +++ b/crates/hir/src/display.rs | |||
@@ -170,7 +170,7 @@ impl HirDisplay for Field { | |||
170 | fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { | 170 | fn hir_fmt(&self, f: &mut HirFormatter) -> Result<(), HirDisplayError> { |
171 | write_visibility(self.parent.module(f.db).id, self.visibility(f.db), f)?; | 171 | write_visibility(self.parent.module(f.db).id, self.visibility(f.db), f)?; |
172 | write!(f, "{}: ", self.name(f.db))?; | 172 | write!(f, "{}: ", self.name(f.db))?; |
173 | self.signature_ty(f.db).hir_fmt(f) | 173 | self.ty(f.db).hir_fmt(f) |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 0acfa582a..d8ccfde0c 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -509,7 +509,7 @@ impl Field { | |||
509 | /// placeholder types for type parameters). This is good for showing | 509 | /// placeholder types for type parameters). This is good for showing |
510 | /// signature help, but not so good to actually get the type of the field | 510 | /// signature help, but not so good to actually get the type of the field |
511 | /// when you actually have a variable of the struct. | 511 | /// when you actually have a variable of the struct. |
512 | pub fn signature_ty(&self, db: &dyn HirDatabase) -> Type { | 512 | pub fn ty(&self, db: &dyn HirDatabase) -> Type { |
513 | let var_id = self.parent.into(); | 513 | let var_id = self.parent.into(); |
514 | let generic_def_id: GenericDefId = match self.parent { | 514 | let generic_def_id: GenericDefId = match self.parent { |
515 | VariantDef::Struct(it) => it.id.into(), | 515 | VariantDef::Struct(it) => it.id.into(), |
@@ -1984,7 +1984,7 @@ impl Type { | |||
1984 | None | 1984 | None |
1985 | } | 1985 | } |
1986 | 1986 | ||
1987 | pub fn type_parameters(&self) -> impl Iterator<Item = Type> + '_ { | 1987 | pub fn type_arguments(&self) -> impl Iterator<Item = Type> + '_ { |
1988 | self.ty | 1988 | self.ty |
1989 | .strip_references() | 1989 | .strip_references() |
1990 | .as_adt() | 1990 | .as_adt() |
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index 3eb9e27ee..f76715d84 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs | |||
@@ -304,11 +304,11 @@ fn module_def_doctest(sema: &Semantics<RootDatabase>, def: hir::ModuleDef) -> Op | |||
304 | let name = adt.name(sema.db); | 304 | let name = adt.name(sema.db); |
305 | let idx = path.rfind(':').map_or(0, |idx| idx + 1); | 305 | let idx = path.rfind(':').map_or(0, |idx| idx + 1); |
306 | let (prefix, suffix) = path.split_at(idx); | 306 | let (prefix, suffix) = path.split_at(idx); |
307 | let mut ty_params = ty.type_parameters().peekable(); | 307 | let mut ty_args = ty.type_arguments().peekable(); |
308 | let params = if ty_params.peek().is_some() { | 308 | let params = if ty_args.peek().is_some() { |
309 | format!( | 309 | format!( |
310 | "<{}>", | 310 | "<{}>", |
311 | ty_params.format_with(", ", |ty, cb| cb(&ty.display(sema.db))) | 311 | ty_args.format_with(", ", |ty, cb| cb(&ty.display(sema.db))) |
312 | ) | 312 | ) |
313 | } else { | 313 | } else { |
314 | String::new() | 314 | String::new() |
diff --git a/crates/ide_assists/src/handlers/extract_function.rs b/crates/ide_assists/src/handlers/extract_function.rs index 5f80a40c8..b30652a9d 100644 --- a/crates/ide_assists/src/handlers/extract_function.rs +++ b/crates/ide_assists/src/handlers/extract_function.rs | |||
@@ -1183,7 +1183,7 @@ fn make_ret_ty(ctx: &AssistContext, module: hir::Module, fun: &Function) -> Opti | |||
1183 | } | 1183 | } |
1184 | FlowHandler::Try { kind: TryKind::Result { ty: parent_ret_ty } } => { | 1184 | FlowHandler::Try { kind: TryKind::Result { ty: parent_ret_ty } } => { |
1185 | let handler_ty = parent_ret_ty | 1185 | let handler_ty = parent_ret_ty |
1186 | .type_parameters() | 1186 | .type_arguments() |
1187 | .nth(1) | 1187 | .nth(1) |
1188 | .map(|ty| make_ty(&ty, ctx, module)) | 1188 | .map(|ty| make_ty(&ty, ctx, module)) |
1189 | .unwrap_or_else(make::ty_unit); | 1189 | .unwrap_or_else(make::ty_unit); |
diff --git a/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs b/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs index c13c6eebe..ce6998d82 100644 --- a/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs +++ b/crates/ide_assists/src/handlers/generate_from_impl_for_enum.rs | |||
@@ -91,7 +91,7 @@ fn existing_from_impl( | |||
91 | 91 | ||
92 | let enum_type = enum_.ty(sema.db); | 92 | let enum_type = enum_.ty(sema.db); |
93 | 93 | ||
94 | let wrapped_type = variant.fields(sema.db).get(0)?.signature_ty(sema.db); | 94 | let wrapped_type = variant.fields(sema.db).get(0)?.ty(sema.db); |
95 | 95 | ||
96 | if enum_type.impls_trait(sema.db, from_trait, &[wrapped_type]) { | 96 | if enum_type.impls_trait(sema.db, from_trait, &[wrapped_type]) { |
97 | Some(()) | 97 | Some(()) |
diff --git a/crates/ide_assists/src/utils/suggest_name.rs b/crates/ide_assists/src/utils/suggest_name.rs index 533624c1f..deafcd630 100644 --- a/crates/ide_assists/src/utils/suggest_name.rs +++ b/crates/ide_assists/src/utils/suggest_name.rs | |||
@@ -227,7 +227,7 @@ fn name_of_type(ty: &hir::Type, db: &RootDatabase) -> Option<String> { | |||
227 | let name = adt.name(db).to_string(); | 227 | let name = adt.name(db).to_string(); |
228 | 228 | ||
229 | if WRAPPER_TYPES.contains(&name.as_str()) { | 229 | if WRAPPER_TYPES.contains(&name.as_str()) { |
230 | let inner_ty = ty.type_parameters().next()?; | 230 | let inner_ty = ty.type_arguments().next()?; |
231 | return name_of_type(&inner_ty, db); | 231 | return name_of_type(&inner_ty, db); |
232 | } | 232 | } |
233 | 233 | ||
diff --git a/crates/ide_completion/src/context.rs b/crates/ide_completion/src/context.rs index 32f81aec1..b005bd773 100644 --- a/crates/ide_completion/src/context.rs +++ b/crates/ide_completion/src/context.rs | |||
@@ -347,7 +347,7 @@ impl<'a> CompletionContext<'a> { | |||
347 | .and_then(|node| ast::RecordExprField::cast(node)) | 347 | .and_then(|node| ast::RecordExprField::cast(node)) |
348 | .and_then(|rf| self.sema.resolve_record_field(&rf).zip(Some(rf))) | 348 | .and_then(|rf| self.sema.resolve_record_field(&rf).zip(Some(rf))) |
349 | .map(|(f, rf)|( | 349 | .map(|(f, rf)|( |
350 | Some(f.0.signature_ty(self.db)), | 350 | Some(f.0.ty(self.db)), |
351 | rf.field_name().map(NameOrNameRef::NameRef), | 351 | rf.field_name().map(NameOrNameRef::NameRef), |
352 | )) | 352 | )) |
353 | .unwrap_or((None, None)) | 353 | .unwrap_or((None, None)) |
@@ -357,7 +357,7 @@ impl<'a> CompletionContext<'a> { | |||
357 | self.sema | 357 | self.sema |
358 | .resolve_record_field(&it) | 358 | .resolve_record_field(&it) |
359 | .map(|f|( | 359 | .map(|f|( |
360 | Some(f.0.signature_ty(self.db)), | 360 | Some(f.0.ty(self.db)), |
361 | it.field_name().map(NameOrNameRef::NameRef), | 361 | it.field_name().map(NameOrNameRef::NameRef), |
362 | )) | 362 | )) |
363 | .unwrap_or((None, None)) | 363 | .unwrap_or((None, None)) |
diff --git a/crates/ide_completion/src/render/enum_variant.rs b/crates/ide_completion/src/render/enum_variant.rs index 832f5ced1..0c0c71134 100644 --- a/crates/ide_completion/src/render/enum_variant.rs +++ b/crates/ide_completion/src/render/enum_variant.rs | |||
@@ -93,7 +93,7 @@ impl<'a> EnumRender<'a> { | |||
93 | .variant | 93 | .variant |
94 | .fields(self.ctx.db()) | 94 | .fields(self.ctx.db()) |
95 | .into_iter() | 95 | .into_iter() |
96 | .map(|field| (field.name(self.ctx.db()), field.signature_ty(self.ctx.db()))); | 96 | .map(|field| (field.name(self.ctx.db()), field.ty(self.ctx.db()))); |
97 | 97 | ||
98 | match self.variant_kind { | 98 | match self.variant_kind { |
99 | StructKind::Tuple | StructKind::Unit => format!( | 99 | StructKind::Tuple | StructKind::Unit => format!( |