Clippy clean

This commit is contained in:
Sunli 2021-01-04 08:18:28 +08:00
parent 9b7196c3d9
commit c0ce4d4473
2 changed files with 7 additions and 25 deletions

View File

@ -9,8 +9,8 @@ pub(super) fn next_if_rule<'a>(pairs: &mut Pairs<'a, Rule>, rule: Rule) -> Optio
None
}
}
pub(super) fn parse_if_rule<'a, T>(
pairs: &mut Pairs<'a, Rule>,
pub(super) fn parse_if_rule<T>(
pairs: &mut Pairs<Rule>,
rule: Rule,
f: impl FnOnce(Pair<Rule>) -> Result<T>,
) -> Result<Option<T>> {

View File

@ -228,37 +228,19 @@ impl MetaType {
}
pub fn is_composite(&self) -> bool {
match self {
MetaType::Object { .. } => true,
MetaType::Interface { .. } => true,
MetaType::Union { .. } => true,
_ => false,
}
matches!(self, MetaType::Object { .. } | MetaType::Interface { .. } | MetaType::Union { .. })
}
pub fn is_abstract(&self) -> bool {
match self {
MetaType::Interface { .. } => true,
MetaType::Union { .. } => true,
_ => false,
}
matches!(self, MetaType::Interface { .. } | MetaType::Union { .. })
}
pub fn is_leaf(&self) -> bool {
match self {
MetaType::Enum { .. } => true,
MetaType::Scalar { .. } => true,
_ => false,
}
matches!(self, MetaType::Enum { .. } | MetaType::Scalar { .. })
}
pub fn is_input(&self) -> bool {
match self {
MetaType::Enum { .. } => true,
MetaType::Scalar { .. } => true,
MetaType::InputObject { .. } => true,
_ => false,
}
matches!(self, MetaType::Enum { .. } | MetaType::Scalar { .. } | MetaType::InputObject { .. })
}
pub fn is_possible_type(&self, type_name: &str) -> bool {
@ -279,7 +261,7 @@ impl MetaType {
}
pub fn type_overlap(&self, ty: &MetaType) -> bool {
if self as *const MetaType == ty as *const MetaType {
if std::ptr::eq(self, ty) {
return true;
}