mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 20:42:04 +00:00
Cleaned up code
This commit is contained in:
parent
e28046c673
commit
b63234e20b
4 changed files with 14 additions and 16 deletions
|
@ -967,11 +967,6 @@ pub struct Variant {
|
|||
}
|
||||
|
||||
impl Variant {
|
||||
pub fn value(self, db: &dyn HirDatabase) -> Option<Expr> {
|
||||
// TODO(ole): Handle missing exprs (+1 to the prev)
|
||||
self.source(db)?.value.expr()
|
||||
}
|
||||
|
||||
pub fn module(self, db: &dyn HirDatabase) -> Module {
|
||||
self.parent.module(db)
|
||||
}
|
||||
|
@ -999,6 +994,15 @@ impl Variant {
|
|||
pub(crate) fn variant_data(self, db: &dyn HirDatabase) -> Arc<VariantData> {
|
||||
db.enum_data(self.parent.id).variants[self.id].variant_data.clone()
|
||||
}
|
||||
|
||||
pub fn value(self, db: &dyn HirDatabase) -> Option<Expr> {
|
||||
// TODO(ole): Handle missing exprs (+1 to the prev)
|
||||
self.source(db)?.value.expr()
|
||||
}
|
||||
|
||||
pub fn eval(self, db: &dyn HirDatabase) -> Result<ComputedExpr, ConstEvalError> {
|
||||
db.const_eval_variant(self.into())
|
||||
}
|
||||
}
|
||||
|
||||
/// Variants inherit visibility from the parent enum.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue