src: address a bunch of clippy::pedantic lints

This commit is contained in:
2025-10-28 02:53:20 -04:00
parent 0bf5a41498
commit 588606e0c4
8 changed files with 50 additions and 51 deletions

View File

@@ -276,7 +276,7 @@ impl<A: Annotation> Default for Expr<A> {
}
impl<A: Annotation> Expr<A> {
pub fn anno(self, annotation: A) -> Anno<Expr<A>, A> {
pub const fn anno(self, annotation: A) -> Anno<Expr<A>, A> {
Anno(self, annotation)
}
@@ -292,15 +292,15 @@ impl<A: Annotation> Expr<A> {
Self::Op(Op::Do, exprs)
}
pub fn is_place(&self) -> bool {
pub const fn is_place(&self) -> bool {
matches!(
self,
Self::Id(_) | Self::Op(Op::Index, _) | Self::Op(Op::Dot, _) | Self::Op(Op::Deref, _)
Self::Id(_) | Self::Op(Op::Index | Op::Dot | Op::Deref, _)
)
}
#[allow(clippy::type_complexity)]
pub fn as_slice(&self) -> Option<(Op, &[Anno<Expr<A>, A>])> {
pub const fn as_slice(&self) -> Option<(Op, &[Anno<Expr<A>, A>])> {
match self {
Expr::Op(op, args) => Some((*op, args.as_slice())),
_ => None,