Skip to content

Commit

Permalink
FIX: Fix code duplication in s![] definition
Browse files Browse the repository at this point in the history
  • Loading branch information
bluss committed Jan 8, 2018
1 parent 16b4c97 commit 067bb9f
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -563,31 +563,11 @@ macro_rules! s(
};
// convert a..b;c into @convert(a..b, c), final item, trailing comma
(@parse $dim:expr, [$($stack:tt)*] $r:expr;$s:expr ,) => {
match $r {
r => {
let out_dim = $crate::SliceNextDim::next_dim(&r, $dim);
unsafe {
$crate::SliceInfo::new_unchecked(
[$($stack)* s!(@convert r, $s)],
out_dim,
)
}
}
}
s![@parse $dim, [$($stack)*] $r;$s]
};
// convert a..b into @convert(a..b), final item, trailing comma
(@parse $dim:expr, [$($stack:tt)*] $r:expr ,) => {
match $r {
r => {
let out_dim = $crate::SliceNextDim::next_dim(&r, $dim);
unsafe {
$crate::SliceInfo::new_unchecked(
[$($stack)* s!(@convert r)],
out_dim,
)
}
}
}
s![@parse $dim, [$($stack)*] $r]
};
// convert a..b;c into @convert(a..b, c)
(@parse $dim:expr, [$($stack:tt)*] $r:expr;$s:expr, $($t:tt)*) => {
Expand Down

0 comments on commit 067bb9f

Please sign in to comment.