Fix clippy issues

This commit is contained in:
Andrew Morris
2023-07-24 10:38:46 +10:00
parent d649272a6e
commit e81eb6d1e2
10 changed files with 23 additions and 38 deletions

View File

@@ -336,8 +336,9 @@ impl std::fmt::Display for LabelRef {
}
}
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Default)]
pub enum Value {
#[default]
Void,
Undefined,
Null,
@@ -352,12 +353,6 @@ pub enum Value {
Builtin(Builtin),
}
impl Default for Value {
fn default() -> Self {
Value::Void
}
}
#[derive(Debug, Clone)]
pub struct Number(pub f64);

View File

@@ -1007,11 +1007,11 @@ pub fn parse_module(content: &str) -> Module {
}
fn is_leading_identifier_char(c: char) -> bool {
c == '_' || ('a'..='z').contains(&c) || ('A'..='Z').contains(&c)
c == '_' || c.is_ascii_alphabetic()
}
fn is_identifier_char(c: char) -> bool {
c == '_' || ('0'..='9').contains(&c) || ('a'..='z').contains(&c) || ('A'..='Z').contains(&c)
c == '_' || c.is_ascii_alphanumeric()
}
fn advance_chars(iter: &mut std::iter::Peekable<std::str::Chars>, len: usize) {

View File

@@ -33,8 +33,9 @@ use super::try_to_kal::TryToKal;
* change program behavior due to believing false things), whereas sometimes type systems (notably
* TypeScript) are not.
*/
#[derive(Clone)]
#[derive(Clone, Default)]
pub enum Kal {
#[default]
Unknown,
Void,
Undefined,
@@ -50,12 +51,6 @@ pub enum Kal {
Builtin(Builtin),
}
impl Default for Kal {
fn default() -> Self {
Kal::Unknown
}
}
#[derive(Clone)]
pub struct Array {
pub values: Vec<Kal>,

View File

@@ -56,7 +56,7 @@ impl TargetAccessor {
) -> TargetAccessor {
use swc_ecma_ast::Expr::*;
return match expr {
match expr {
Ident(ident) => TargetAccessor::compile_ident(ec, &CrateIdent::from_swc_ident(ident)),
This(this) => TargetAccessor::compile_ident(ec, &CrateIdent::this(this.span)),
Member(member) => {
@@ -98,7 +98,7 @@ impl TargetAccessor {
TargetAccessor::make_bad(ec)
}
};
}
}
pub fn compile_ident(ec: &mut ExpressionCompiler, ident: &CrateIdent) -> TargetAccessor {