Skip to content

Commit

Permalink
remove Type/etc, clean imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Manishearth committed Feb 7, 2024
1 parent 4ee02c9 commit 07a744e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 30 deletions.
12 changes: 0 additions & 12 deletions core/src/hir/lifetimes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,18 +225,6 @@ impl<T> MaybeStatic<T> {
}
}

/// The [`LifetimeKind`] of [`Lifetimes`]
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[allow(clippy::exhaustive_structs)] // marker type
pub struct Type;

pub type Method = Type;

/// Abstraction over where lifetimes can occur
pub trait LifetimeKind: Copy + Clone + Debug + Hash + PartialEq + Eq + PartialOrd + Ord {}

impl LifetimeKind for Type {}

/// A lifetime that exists as part of a type or method signature.
///
/// This index only makes sense in the context of a surrounding type or method; since
Expand Down
13 changes: 6 additions & 7 deletions core/src/hir/lowering.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use super::lifetimes::{self, BoundedLifetime, Lifetime, LifetimeEnv, LifetimeKind};
use super::{
AttributeContext, AttributeValidator, Attrs, Borrow, EnumDef, EnumPath, EnumVariant, IdentBuf,
LifetimeLowerer, LookupId, MaybeOwn, Method, NonOptional, OpaqueDef, OpaquePath, Optional,
OutStructDef, OutStructField, OutStructPath, OutType, Param, ParamLifetimeLowerer, ParamSelf,
PrimitiveType, ReturnLifetimeLowerer, ReturnType, ReturnableStructPath,
SelfParamLifetimeLowerer, SelfType, Slice, StructDef, StructField, StructPath, SuccessType,
Type,
AttributeContext, AttributeValidator, Attrs, Borrow, BoundedLifetime, EnumDef, EnumPath,
EnumVariant, IdentBuf, Lifetime, LifetimeEnv, LifetimeLowerer, LookupId, MaybeOwn, Method,
NonOptional, OpaqueDef, OpaquePath, Optional, OutStructDef, OutStructField, OutStructPath,
OutType, Param, ParamLifetimeLowerer, ParamSelf, PrimitiveType, ReturnLifetimeLowerer,
ReturnType, ReturnableStructPath, SelfParamLifetimeLowerer, SelfType, Slice, StructDef,
StructField, StructPath, SuccessType, Type,
};
use crate::ast::attrs::AttrInheritContext;
use crate::{ast, Env};
Expand Down
11 changes: 2 additions & 9 deletions core/src/hir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@
mod attrs;
mod defs;
mod elision;
// We don't reexport this for two reasons.
//
// One is that these are somewhat more niche types and we don't want to clutter the main module too
// much. You only need these if you're dealing with lifetimes, which not all backends may wish to
// do.
//
// Two is that this module contains types named Type and Method which will conflict with others.
pub mod lifetimes;
pub use lifetimes::{Lifetime, LifetimeEnv, Lifetimes, MaybeStatic, LifetimeKind};
mod lifetimes;
mod lowering;
mod methods;
mod paths;
Expand All @@ -24,6 +16,7 @@ mod types;
pub use attrs::*;
pub use defs::*;
pub(super) use elision::*;
pub use lifetimes::*;
pub(super) use lowering::*;
pub use methods::*;
pub use paths::*;
Expand Down
4 changes: 2 additions & 2 deletions tool/src/dart/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use askama::Template;
use diplomat_core::ast::DocsUrlGenerator;
use diplomat_core::hir::TypeContext;
use diplomat_core::hir::{
self, OpaqueOwner, ReturnType, SelfType, StructPathLike, SuccessType, TyPosition, Type,
TypeDef, TypeId, Lifetime, LifetimeEnv, LifetimeKind, Lifetimes, MaybeStatic,
self, Lifetime, LifetimeEnv, Lifetimes, MaybeStatic, OpaqueOwner, ReturnType, SelfType,
StructPathLike, SuccessType, TyPosition, Type, TypeDef, TypeId,
};
use formatter::DartFormatter;
use std::borrow::Cow;
Expand Down

0 comments on commit 07a744e

Please sign in to comment.