Skip to content

Commit

Permalink
chore: move lazy_static to once_cell, and some clippy fix
Browse files Browse the repository at this point in the history
  • Loading branch information
hzlinyiyu-netease committed Feb 20, 2024
1 parent 81f923c commit 9930400
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion logos-codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[dependencies]
beef = "0.5.0"
fnv = "1.0.6"
lazy_static = "1.4.0"
once_cell = "1.19.0"
proc-macro2 = "1.0.9"
quote = "1.0.3"
regex-syntax = "0.8.2"
Expand Down
2 changes: 1 addition & 1 deletion logos-codegen/src/graph/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ mod debug {
use super::*;
use crate::graph::rope::Miss;
use crate::graph::Disambiguate;
use std::cmp::{Ord, Ordering};
use std::cmp::Ordering;

impl Disambiguate for &str {
fn cmp(left: &&str, right: &&str) -> Ordering {
Expand Down
2 changes: 1 addition & 1 deletion logos-codegen/src/graph/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use regex_syntax::hir::ClassBytesRange;
use regex_syntax::hir::ClassUnicodeRange;
use regex_syntax::utf8::Utf8Range;

use std::cmp::{Ord, Ordering};
use std::cmp::Ordering;

#[derive(Clone, Copy, PartialEq, Eq, Hash)]
pub struct Range {
Expand Down
1 change: 0 additions & 1 deletion logos-codegen/src/graph/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,6 @@ fn is_one_ascii(class: &ClassUnicode, repeated: bool) -> bool {
#[cfg(test)]
mod tests {
use super::*;
use crate::graph::Node;
use pretty_assertions::assert_eq;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion logos-codegen/src/leaf.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::cmp::{Ord, Ordering};
use std::cmp::Ordering;
use std::fmt::{self, Debug, Display};

use proc_macro2::{Span, TokenStream};
Expand Down
10 changes: 3 additions & 7 deletions logos-codegen/src/mir.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
use std::convert::TryFrom;

use lazy_static::lazy_static;
use once_cell::sync::Lazy;
use regex_syntax::hir::{Dot, Hir, HirKind};
use regex_syntax::ParserBuilder;

pub use regex_syntax::hir::{Class, ClassUnicode, Literal};

use crate::error::{Error, Result};

lazy_static! {
static ref DOT_UTF8: Hir = Hir::dot(Dot::AnyChar);
static ref DOT_BYTES: Hir = Hir::dot(Dot::AnyByte);
}
static DOT_UTF8: Lazy<Hir> = Lazy::new(|| Hir::dot(Dot::AnyChar));
static DOT_BYTES: Lazy<Hir> = Lazy::new(|| Hir::dot(Dot::AnyByte));

/// Middle Intermediate Representation of the regex, built from
/// `regex_syntax`'s `Hir`. The goal here is to strip and canonicalize
Expand Down

0 comments on commit 9930400

Please sign in to comment.