mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
SigKind -> CallableKind
This commit is contained in:
parent
01238a6fd7
commit
b915bf2d05
1 changed files with 10 additions and 10 deletions
|
@ -13,16 +13,16 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum SigKind {
|
pub enum CallableKind {
|
||||||
Function,
|
Function,
|
||||||
Struct,
|
StructConstructor,
|
||||||
EnumVariant,
|
VariantConstructor,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Contains information about a function signature
|
/// Contains information about a function signature
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct FunctionSignature {
|
pub struct FunctionSignature {
|
||||||
pub kind: SigKind,
|
pub kind: CallableKind,
|
||||||
/// Optional visibility
|
/// Optional visibility
|
||||||
pub visibility: Option<String>,
|
pub visibility: Option<String>,
|
||||||
/// Name of the function
|
/// Name of the function
|
||||||
|
@ -69,7 +69,7 @@ impl FunctionSignature {
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
FunctionSignature {
|
FunctionSignature {
|
||||||
kind: SigKind::Struct,
|
kind: CallableKind::StructConstructor,
|
||||||
visibility: node.visibility().map(|n| n.syntax().text().to_string()),
|
visibility: node.visibility().map(|n| n.syntax().text().to_string()),
|
||||||
name: node.name().map(|n| n.text().to_string()),
|
name: node.name().map(|n| n.text().to_string()),
|
||||||
ret_type: node.name().map(|n| n.text().to_string()),
|
ret_type: node.name().map(|n| n.text().to_string()),
|
||||||
|
@ -111,7 +111,7 @@ impl FunctionSignature {
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
FunctionSignature {
|
FunctionSignature {
|
||||||
kind: SigKind::EnumVariant,
|
kind: CallableKind::VariantConstructor,
|
||||||
visibility: None,
|
visibility: None,
|
||||||
name: Some(name),
|
name: Some(name),
|
||||||
ret_type: None,
|
ret_type: None,
|
||||||
|
@ -140,7 +140,7 @@ impl From<&'_ ast::FnDef> for FunctionSignature {
|
||||||
}
|
}
|
||||||
|
|
||||||
FunctionSignature {
|
FunctionSignature {
|
||||||
kind: SigKind::Function,
|
kind: CallableKind::Function,
|
||||||
visibility: node.visibility().map(|n| n.syntax().text().to_string()),
|
visibility: node.visibility().map(|n| n.syntax().text().to_string()),
|
||||||
name: node.name().map(|n| n.text().to_string()),
|
name: node.name().map(|n| n.text().to_string()),
|
||||||
ret_type: node
|
ret_type: node
|
||||||
|
@ -164,9 +164,9 @@ impl Display for FunctionSignature {
|
||||||
|
|
||||||
if let Some(name) = &self.name {
|
if let Some(name) = &self.name {
|
||||||
match self.kind {
|
match self.kind {
|
||||||
SigKind::Function => write!(f, "fn {}", name)?,
|
CallableKind::Function => write!(f, "fn {}", name)?,
|
||||||
SigKind::Struct => write!(f, "struct {}", name)?,
|
CallableKind::StructConstructor => write!(f, "struct {}", name)?,
|
||||||
SigKind::EnumVariant => write!(f, "{}", name)?,
|
CallableKind::VariantConstructor => write!(f, "{}", name)?,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue