Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: move lazy_static to once_cell, and some clippy fix #380

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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};
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unsync::Lazy is probably a better choice here.

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
Loading