forked from M-Labs/nalgebra
Allow trailing punctuation in macros
This commit is contained in:
parent
4a5183ae59
commit
181291cb2d
@ -223,7 +223,7 @@ impl Parse for Vector {
|
|||||||
elements: Vec::new(),
|
elements: Vec::new(),
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let elements = MatrixRowSyntax::parse_separated_nonempty(input)?
|
let elements = MatrixRowSyntax::parse_terminated(input)?
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.collect();
|
.collect();
|
||||||
Ok(Self { elements })
|
Ok(Self { elements })
|
||||||
|
@ -94,6 +94,12 @@ fn dmatrix_small_dims_exhaustive() {
|
|||||||
DMatrix::from_row_slice(4, 4, &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]));
|
DMatrix::from_row_slice(4, 4, &[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn matrix_trailing_semi() {
|
||||||
|
matrix![1, 2;];
|
||||||
|
dmatrix![1, 2;];
|
||||||
|
}
|
||||||
|
|
||||||
// Skip rustfmt because it just makes the test bloated without making it more readable
|
// Skip rustfmt because it just makes the test bloated without making it more readable
|
||||||
#[rustfmt::skip]
|
#[rustfmt::skip]
|
||||||
#[test]
|
#[test]
|
||||||
@ -151,6 +157,13 @@ fn dvector_small_dims_exhaustive() {
|
|||||||
assert_eq_and_type!(dvector![1, 2, 3, 4, 5, 6], DVector::from_column_slice(&[1, 2, 3, 4, 5, 6]));
|
assert_eq_and_type!(dvector![1, 2, 3, 4, 5, 6], DVector::from_column_slice(&[1, 2, 3, 4, 5, 6]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn vector_trailing_comma() {
|
||||||
|
vector![1, 2,];
|
||||||
|
point![1, 2,];
|
||||||
|
dvector![1, 2,];
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn matrix_trybuild_tests() {
|
fn matrix_trybuild_tests() {
|
||||||
let t = trybuild::TestCases::new();
|
let t = trybuild::TestCases::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user