diff options
author | Aleksey Kladov <[email protected]> | 2021-04-30 09:55:59 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2021-04-30 09:55:59 +0100 |
commit | 1a01a5ae190ad02e44c3550ac0336b1f0983be51 (patch) | |
tree | b779be1e0b4b4fa0a7afda5dc6d81ec11f5eb428 /crates | |
parent | cb3ef552e873a86e94a3792160fadb5d937a6f5f (diff) |
internal: fix naming polarity
Type Constructors have *parameters*, when they are substituted with type
*arguments*, we have a type.
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir/src/lib.rs | 2 | ||||
-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/utils/suggest_name.rs | 2 |
4 files changed, 6 insertions, 6 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs index 9eb7672da..d8ccfde0c 100644 --- a/crates/hir/src/lib.rs +++ b/crates/hir/src/lib.rs | |||
@@ -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/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 | ||