mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-01 04:18:20 +00:00
rename function so it makes more sense
This commit is contained in:
parent
41cd1732b7
commit
03276f8a24
3 changed files with 5 additions and 5 deletions
|
|
@ -9,7 +9,7 @@ use syntax::{
|
|||
|
||||
use crate::{
|
||||
AssistContext, AssistId, Assists, assist_context::SourceChangeBuilder,
|
||||
utils::find_struct_definition_from_cursor,
|
||||
utils::get_struct_definition_from_context,
|
||||
};
|
||||
|
||||
// Assist: convert_named_struct_to_tuple_struct
|
||||
|
|
@ -59,7 +59,7 @@ pub(crate) fn convert_named_struct_to_tuple_struct(
|
|||
// XXX: We don't currently provide this assist for struct definitions inside macros, but if we
|
||||
// are to lift this limitation, don't forget to make `edit_struct_def()` consider macro files
|
||||
// too.
|
||||
let strukt = find_struct_definition_from_cursor(ctx)?;
|
||||
let strukt = get_struct_definition_from_context(ctx)?;
|
||||
let field_list = strukt.as_ref().either(|s| s.field_list(), |v| v.field_list())?;
|
||||
let record_fields = match field_list {
|
||||
ast::FieldList::RecordFieldList(it) => it,
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ use syntax::{
|
|||
|
||||
use crate::{
|
||||
AssistContext, AssistId, Assists, assist_context::SourceChangeBuilder,
|
||||
utils::find_struct_definition_from_cursor,
|
||||
utils::get_struct_definition_from_context,
|
||||
};
|
||||
|
||||
// Assist: convert_tuple_struct_to_named_struct
|
||||
|
|
@ -54,7 +54,7 @@ pub(crate) fn convert_tuple_struct_to_named_struct(
|
|||
acc: &mut Assists,
|
||||
ctx: &AssistContext<'_>,
|
||||
) -> Option<()> {
|
||||
let strukt = find_struct_definition_from_cursor(ctx)?;
|
||||
let strukt = get_struct_definition_from_context(ctx)?;
|
||||
let field_list = strukt.as_ref().either(|s| s.field_list(), |v| v.field_list())?;
|
||||
let tuple_fields = match field_list {
|
||||
ast::FieldList::TupleFieldList(it) => it,
|
||||
|
|
|
|||
|
|
@ -1150,7 +1150,7 @@ pub fn is_body_const(sema: &Semantics<'_, RootDatabase>, expr: &ast::Expr) -> bo
|
|||
}
|
||||
|
||||
/// Gets the struct definition from a context
|
||||
pub(crate) fn find_struct_definition_from_cursor(
|
||||
pub(crate) fn get_struct_definition_from_context(
|
||||
ctx: &AssistContext<'_>,
|
||||
) -> Option<Either<ast::Struct, ast::Variant>> {
|
||||
ctx.find_node_at_offset::<ast::Name>()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue