remove unneded From(..) impl

This commit is contained in:
Aleksey Kladov 2019-06-11 18:07:42 +03:00
parent 0dcaded439
commit 26753f0e49
4 changed files with 21 additions and 37 deletions

View file

@ -11,7 +11,7 @@ use ra_syntax::{
use crate::{
Name, AsName, Struct, Union, Enum, EnumVariant, Crate, AstDatabase,
HirDatabase, HirFileId, StructField, FieldSource, Source, HasSource,
HirDatabase, StructField, FieldSource, Source, HasSource,
type_ref::TypeRef, DefDatabase,
};
@ -201,10 +201,7 @@ impl VariantDef {
}
impl StructField {
pub(crate) fn source_impl(
&self,
db: &(impl DefDatabase + AstDatabase),
) -> (HirFileId, FieldSource) {
pub(crate) fn source_impl(&self, db: &(impl DefDatabase + AstDatabase)) -> Source<FieldSource> {
let var_data = self.parent.variant_data(db);
let fields = var_data.fields().unwrap();
let ss;
@ -229,12 +226,12 @@ impl StructField {
}
ast::StructKind::Unit => Vec::new(),
};
let field = field_sources
let ast = field_sources
.into_iter()
.zip(fields.iter())
.find(|(_syntax, (id, _))| *id == self.id)
.unwrap()
.0;
(file_id, field)
Source { file_id, ast }
}
}