mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
cleanup imports
This commit is contained in:
parent
939f05f3e3
commit
88267c86c0
31 changed files with 104 additions and 101 deletions
|
@ -4,13 +4,11 @@ use std::fmt::{self, Display};
|
|||
|
||||
use hir::{Docs, Documentation, HasSource, HirDisplay};
|
||||
use join_to_string::join;
|
||||
use ra_ide_db::RootDatabase;
|
||||
use ra_syntax::ast::{self, AstNode, NameOwner, VisibilityOwner};
|
||||
use std::convert::From;
|
||||
|
||||
use crate::{
|
||||
db,
|
||||
display::{generic_parameters, where_predicates},
|
||||
};
|
||||
use crate::display::{generic_parameters, where_predicates};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum CallableKind {
|
||||
|
@ -48,13 +46,13 @@ impl FunctionSignature {
|
|||
self
|
||||
}
|
||||
|
||||
pub(crate) fn from_hir(db: &db::RootDatabase, function: hir::Function) -> Self {
|
||||
pub(crate) fn from_hir(db: &RootDatabase, function: hir::Function) -> Self {
|
||||
let doc = function.docs(db);
|
||||
let ast_node = function.source(db).value;
|
||||
FunctionSignature::from(&ast_node).with_doc_opt(doc)
|
||||
}
|
||||
|
||||
pub(crate) fn from_struct(db: &db::RootDatabase, st: hir::Struct) -> Option<Self> {
|
||||
pub(crate) fn from_struct(db: &RootDatabase, st: hir::Struct) -> Option<Self> {
|
||||
let node: ast::StructDef = st.source(db).value;
|
||||
match node.kind() {
|
||||
ast::StructKind::Record(_) => return None,
|
||||
|
@ -86,10 +84,7 @@ impl FunctionSignature {
|
|||
)
|
||||
}
|
||||
|
||||
pub(crate) fn from_enum_variant(
|
||||
db: &db::RootDatabase,
|
||||
variant: hir::EnumVariant,
|
||||
) -> Option<Self> {
|
||||
pub(crate) fn from_enum_variant(db: &RootDatabase, variant: hir::EnumVariant) -> Option<Self> {
|
||||
let node: ast::EnumVariant = variant.source(db).value;
|
||||
match node.kind() {
|
||||
ast::StructKind::Record(_) | ast::StructKind::Unit => return None,
|
||||
|
@ -126,7 +121,7 @@ impl FunctionSignature {
|
|||
)
|
||||
}
|
||||
|
||||
pub(crate) fn from_macro(db: &db::RootDatabase, macro_def: hir::MacroDef) -> Option<Self> {
|
||||
pub(crate) fn from_macro(db: &RootDatabase, macro_def: hir::MacroDef) -> Option<Self> {
|
||||
let node: ast::MacroCall = macro_def.source(db).value;
|
||||
|
||||
let params = vec![];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue