Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/ide-assists/src/utils.rs')
| -rw-r--r-- | crates/ide-assists/src/utils.rs | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/crates/ide-assists/src/utils.rs b/crates/ide-assists/src/utils.rs index c7a6c2d532..ef6914fda1 100644 --- a/crates/ide-assists/src/utils.rs +++ b/crates/ide-assists/src/utils.rs @@ -1,7 +1,5 @@ //! Assorted functions shared by several assists. -use either::Either; - pub(crate) use gen_trait_fn_body::gen_trait_fn_body; use hir::{ DisplayTarget, HasAttrs as HirHasAttrs, HirDisplay, InFile, ModuleDef, PathResolution, @@ -1148,19 +1146,3 @@ pub fn is_body_const(sema: &Semantics<'_, RootDatabase>, expr: &ast::Expr) -> bo }); is_const } - -/// Gets the struct definition from a context -pub(crate) fn get_struct_definition_from_context( - ctx: &AssistContext<'_>, -) -> Option<Either<ast::Struct, ast::Variant>> { - ctx.find_node_at_offset::<ast::Name>() - .and_then(|name| name.syntax().parent()) - .or(ctx - .token_at_offset() - .find(|leaf| matches!(leaf.kind(), STRUCT_KW)) - .and_then(|kw| kw.parent())) - .or(ctx - .find_node_at_offset::<ast::Visibility>() - .and_then(|visibility| visibility.syntax().parent())) - .and_then(<Either<ast::Struct, ast::Variant>>::cast) -} |