Skip to content

Commit

Permalink
Prefix does_impl with an underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
nvzqz committed Dec 29, 2019
1 parent 98c250a commit 1513008
Showing 1 changed file with 21 additions and 21 deletions.
42 changes: 21 additions & 21 deletions src/assert_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,14 @@ macro_rules! assert_impl {
fn assert_impl<$($generic)*>() {
// Construct an expression using True/False and their operators, that corresponds to
// the provided expression.
let _: $crate::True = $crate::does_impl!($ty: $($rest)*);
let _: $crate::True = $crate::_does_impl!($ty: $($rest)*);
}
};
};
($ty:ty: $($rest:tt)*) => {
// Construct an expression using True/False and their operators, that corresponds to
// the provided expression.
const _: $crate::True = $crate::does_impl!($ty: $($rest)*);
const _: $crate::True = $crate::_does_impl!($ty: $($rest)*);
};
}

Expand All @@ -351,52 +351,52 @@ macro_rules! assert_impl {
/// This is the core of `assert_impl`.
#[doc(hidden)]
#[macro_export(local_inner_macros)]
macro_rules! does_impl {
macro_rules! _does_impl {
(@boolexpr($($args:tt)*) ($($expr:tt)*)) => {
does_impl!(@boolexpr($($args)*) $($expr)*)
_does_impl!(@boolexpr($($args)*) $($expr)*)
};
(@boolexpr($($args:tt)*) !($($expr:tt)*)) => {
does_impl!(@boolexpr($($args)*) $($expr)*).not()
_does_impl!(@boolexpr($($args)*) $($expr)*).not()
};
(@boolexpr($($args:tt)*) ($($left:tt)*) || $($right:tt)*) => {{
let left = does_impl!(@boolexpr($($args)*) $($left)*);
let right = does_impl!(@boolexpr($($args)*) $($right)*);
let left = _does_impl!(@boolexpr($($args)*) $($left)*);
let right = _does_impl!(@boolexpr($($args)*) $($right)*);
left.or(right)
}};
(@boolexpr($($args:tt)*) ($($left:tt)*) && $($right:tt)*) => {{
let left = does_impl!(@boolexpr($($args)*) $($left)*);
let right = does_impl!(@boolexpr($($args)*) $($right)*);
let left = _does_impl!(@boolexpr($($args)*) $($left)*);
let right = _does_impl!(@boolexpr($($args)*) $($right)*);
left.and(right)
}};
(@boolexpr($($args:tt)*) !($($left:tt)*) || $($right:tt)*) => {{
does_impl!(@boolexpr($($args)*) (!($($left)*)) || $($right)*)
_does_impl!(@boolexpr($($args)*) (!($($left)*)) || $($right)*)
}};
(@boolexpr($($args:tt)*) !($($left:tt)*) && $($right:tt)*) => {{
does_impl!(@boolexpr($($args)*) (!($($left)*)) && $($right)*)
_does_impl!(@boolexpr($($args)*) (!($($left)*)) && $($right)*)
}};
(@boolexpr($($args:tt)*) !$left:ident || $($right:tt)*) => {{
does_impl!(@boolexpr($($args)*) !($left) || $($right)*)
_does_impl!(@boolexpr($($args)*) !($left) || $($right)*)
}};
(@boolexpr($($args:tt)*) !$left:ident && $($right:tt)*) => {{
does_impl!(@boolexpr($($args)*) !($left) && $($right)*)
_does_impl!(@boolexpr($($args)*) !($left) && $($right)*)
}};
(@boolexpr($($args:tt)*) $left:ident || $($right:tt)*) => {
does_impl!(@boolexpr($($args)*) ($left) || $($right)*)
_does_impl!(@boolexpr($($args)*) ($left) || $($right)*)
};
(@boolexpr($($args:tt)*) $left:ident && $($right:tt)*) => {{
does_impl!(@boolexpr($($args)*) ($left) && $($right)*)
_does_impl!(@boolexpr($($args)*) ($left) && $($right)*)
}};
(@boolexpr($($args:tt)*) !$expr:ident) => {
does_impl!(@boolexpr($($args)*) !($expr))
_does_impl!(@boolexpr($($args)*) !($expr))
};
(@boolexpr($($args:tt)*) !$expr:path) => {
does_impl!(@boolexpr($($args)*) !($expr))
_does_impl!(@boolexpr($($args)*) !($expr))
};
(@boolexpr($($args:tt)*) $expr:ident) => {
does_impl!(@base($($args)*) $expr)
_does_impl!(@base($($args)*) $expr)
};
(@boolexpr($($args:tt)*) $expr:path) => {
does_impl!(@base($($args)*) $expr)
_does_impl!(@base($($args)*) $expr)
};

(@base($ty:ty, $($args:tt)*) $($trait:tt)*) => {{
Expand All @@ -406,7 +406,7 @@ macro_rules! does_impl {
const DOES_IMPL: True = True;
}

// If `$type: $trait`, the `does_impl` inherent method on `Wrapper` will be called, and
// If `$type: $trait`, the `_does_impl` inherent method on `Wrapper` will be called, and
// return `True`. Otherwise, the trait method will be called, which returns `False`.
&<Wrapper<$ty>>::DOES_IMPL
}};
Expand All @@ -426,6 +426,6 @@ macro_rules! does_impl {

// Construct an expression using True/False and their operators, that corresponds to
// the provided expression.
*does_impl!(@boolexpr($ty,) $($rest)*)
*_does_impl!(@boolexpr($ty,) $($rest)*)
}};
}

0 comments on commit 1513008

Please sign in to comment.