chore: fmt

This commit is contained in:
2025-05-10 20:13:00 +08:00
parent 046b03c60e
commit d04d46c905
7 changed files with 49 additions and 53 deletions

View File

@@ -3,11 +3,10 @@ use std::collections::HashMap;
use ecow::EcoString;
use rnix::ast::{self, Expr};
use crate::bytecode::{Consts, ThunkIdx, FuncIdx};
use crate::compile::*;
use crate::error::*;
#[cfg(feature = "jit")]
use crate::jit::*;
use crate::error::*;
use crate::ty::internal as i;
pub fn downgrade(expr: Expr) -> Result<Downgraded> {
@@ -17,7 +16,7 @@ pub fn downgrade(expr: Expr) -> Result<Downgraded> {
top_level: ir,
consts: ctx.consts.into(),
thunks: ctx.thunks.into(),
funcs: ctx.funcs.into()
funcs: ctx.funcs.into(),
})
}
@@ -115,7 +114,7 @@ ir! {
UnOp => { rhs: Box<Ir>, kind: UnOpKind },
Select => { expr: Box<Ir>, attrpath: Vec<Attr>, default: Option<Box<Ir>> },
If => { cond: Box<Ir>, consq: Box<Ir>, alter: Box<Ir> },
LoadFunc => { idx: FuncIdx },
LoadFunc => { idx: usize },
Call => { func: Box<Ir>, args: Vec<Ir> },
Let => { attrs: Attrs, expr: Box<Ir> },
@@ -125,7 +124,7 @@ ir! {
Const => { value: i::Const },
Var => { sym: EcoString },
#[derive(Copy)]
Thunk => { idx: ThunkIdx },
Thunk => { idx: usize },
Path => { expr: Box<Ir> },
}
@@ -141,9 +140,9 @@ pub struct DowngradeContext {
pub struct Downgraded {
pub top_level: Ir,
pub consts: Consts,
pub consts: Box<[i::Const]>,
pub thunks: Box<[Ir]>,
pub funcs: Box<[Func]>
pub funcs: Box<[Func]>,
}
impl DowngradeContext {
@@ -174,9 +173,11 @@ impl Attrs {
.get_mut(&ident)
.unwrap()
.downcast_mut()
.ok_or_else(|| Error::DowngradeError(format!(
r#""{ident}" already exsists in this set"#
)))
.ok_or_else(|| {
Error::DowngradeError(format!(
r#""{ident}" already exsists in this set"#
))
})
.and_then(|attrs: &mut Attrs| attrs._insert(path, name, value))
} else {
let mut attrs = Attrs {