Skip to content

Commit

Permalink
feat: impl Source for T: Deref in no_std (#406)
Browse files Browse the repository at this point in the history
* impl Sourc for T: Deref in no_std

* minor improve

* fmt
  • Loading branch information
yjhmelody authored Aug 8, 2024
1 parent 0cf2708 commit 4763628
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
5 changes: 2 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,11 @@
#![warn(missing_docs)]
#![doc(html_logo_url = "https://maciej.codes/kosz/logos.png")]

#[cfg(not(feature = "std"))]
extern crate core as std;
extern crate core;

use core::fmt::Debug;
#[cfg(feature = "export_derive")]
pub use logos_derive::Logos;
use std::fmt::Debug;

mod lexer;
pub mod source;
Expand Down
8 changes: 2 additions & 6 deletions src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
//! * `Source` - implemented by default for `&str`, `&[u8]` and wrapper types, used by the `Lexer`.
//! * `Slice` - slices of `Source`, returned by `Lexer::slice`.
use std::fmt::Debug;
use std::ops::Range;
use core::fmt::Debug;
use core::ops::{Deref, Range};

/// Trait for types the `Lexer` can read from.
///
Expand Down Expand Up @@ -201,10 +201,6 @@ impl Source for [u8] {
}
}

#[cfg(feature = "std")]
use std::ops::Deref;

#[cfg(feature = "std")]
impl<T> Source for T
where
T: Deref,
Expand Down

0 comments on commit 4763628

Please sign in to comment.