Skip to content

Commit

Permalink
nalgebra-macros: Remove clippy pedantic, fix clippy complaints
Browse files Browse the repository at this point in the history
pedantic seems to be mostly intent on wasting the programmer's time
  • Loading branch information
Andlon committed Apr 1, 2024
1 parent c3749bc commit 7940bd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 2 additions & 3 deletions nalgebra-macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
future_incompatible,
missing_copy_implementations,
missing_debug_implementations,
clippy::all,
clippy::pedantic
clippy::all
)]

mod matrix_vector_impl;
Expand Down Expand Up @@ -256,5 +255,5 @@ pub fn point(stream: TokenStream) -> TokenStream {
#[proc_macro]
pub fn stack(stream: TokenStream) -> TokenStream {
let matrix = parse_macro_input!(stream as Matrix);
proc_macro::TokenStream::from(stack_impl(matrix).unwrap_or_else(|err| err.into_compile_error()))
proc_macro::TokenStream::from(stack_impl(matrix).unwrap_or_else(syn::Error::into_compile_error))
}
8 changes: 4 additions & 4 deletions nalgebra-macros/src/stack_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn stack_impl(matrix: Matrix) -> syn::Result<TokenStream2> {
let dim = (0 ..n_block_cols)
.filter_map(|j| {
let expr = &matrix[(i, j)];
if !is_literal_zero(&expr) {
if !is_literal_zero(expr) {
let mut ident_shape = format_ident!("{}_stack_{}_{}_shape", prefix, i, j);
ident_shape.set_span(ident_shape.span().located_at(expr.span()));
Some(quote_spanned!{expr.span()=> #ident_shape.0 })
Expand Down Expand Up @@ -79,7 +79,7 @@ pub fn stack_impl(matrix: Matrix) -> syn::Result<TokenStream2> {
let dim = (0 ..n_block_rows)
.filter_map(|i| {
let expr = &matrix[(i, j)];
if !is_literal_zero(&expr) {
if !is_literal_zero(expr) {
let mut ident_shape = format_ident!("{}_stack_{}_{}_shape", prefix, i, j);
ident_shape.set_span(ident_shape.span().located_at(expr.span()));
Some(quote_spanned!{expr.span()=> #ident_shape.1 })
Expand Down Expand Up @@ -223,7 +223,7 @@ mod tests {
matrix
}};

assert_eq!(format!("{}", result), format!("{}", expected));
assert_eq!(format!("{result}"), format!("{}", expected));
}

#[test]
Expand Down Expand Up @@ -297,6 +297,6 @@ mod tests {
matrix
}};

assert_eq!(format!("{}", result), format!("{}", expected));
assert_eq!(format!("{result}"), format!("{}", expected));
}
}

0 comments on commit 7940bd5

Please sign in to comment.