Skip to content

Commit

Permalink
consolidate macros in one file
Browse files Browse the repository at this point in the history
  • Loading branch information
vic1707 committed Sep 24, 2023
1 parent 0fc9475 commit a4c8095
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ rustflags = [
"-Aclippy::question_mark_used", # convenience
"-Aclippy::single_call_fn", # function only called once
"-Aclippy::single_char_lifetime_names", # common practice to use 'a, to remove ?
"-Aclippy::pub-with-shorthand", # export of `yeet!` macro is problematic with this lint
"-Aclippy::pub-with-shorthand", # pub(<scope>) instead of pub(in <scope>)
## Must remove ##
"-Aclippy::missing_docs_in_private_items",
"-Aclippy::missing-errors-doc",
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
#![allow(clippy::pub_use)]
/* Modules */
mod element;
#[doc(hidden)]
mod macros;
mod parser;
mod token;
mod trust_me;
mod yeet;
/* Tests */
#[cfg(test)]
mod tests;
Expand Down
20 changes: 20 additions & 0 deletions src/macros.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#[doc(hidden)]
macro_rules! trust_me {
($($t:tt)*) => {
unsafe { $($t)* }
}
}

pub(crate) use trust_me;

#[doc(hidden)]
macro_rules! yeet {
() => {
return None
};
($err:expr) => {
return Err($err)
};
}

pub(crate) use yeet;
3 changes: 1 addition & 2 deletions src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use core::str;
use crate::{
element::{BinOp, Element, FunctionCall, UnOp},
token::{Identifier, Operator},
trust_me::trust_me,
yeet::yeet,
macros::{trust_me, yeet},
};
/* Constants */
pub const NO_PERCEDENCE: usize = 0;
Expand Down
8 changes: 0 additions & 8 deletions src/trust_me.rs

This file was deleted.

11 changes: 0 additions & 11 deletions src/yeet.rs

This file was deleted.

0 comments on commit a4c8095

Please sign in to comment.