From ac4860a8cc1c98ca1d5ce7f2385f27db048ebfad Mon Sep 17 00:00:00 2001 From: Andreas Longva Date: Mon, 1 Apr 2024 15:33:02 +0200 Subject: [PATCH] nalgebra-macros: Remove clippy pedantic, fix clippy complaints pedantic seems to be mostly intent on wasting the programmer's time --- nalgebra-macros/src/lib.rs | 3 +-- nalgebra-macros/src/stack_impl.rs | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/nalgebra-macros/src/lib.rs b/nalgebra-macros/src/lib.rs index 722323f8b..f63a8e356 100644 --- a/nalgebra-macros/src/lib.rs +++ b/nalgebra-macros/src/lib.rs @@ -13,7 +13,6 @@ missing_copy_implementations, missing_debug_implementations, clippy::all, - clippy::pedantic )] mod matrix_vector_impl; @@ -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)) } diff --git a/nalgebra-macros/src/stack_impl.rs b/nalgebra-macros/src/stack_impl.rs index caaa50819..eaa441332 100644 --- a/nalgebra-macros/src/stack_impl.rs +++ b/nalgebra-macros/src/stack_impl.rs @@ -42,7 +42,7 @@ pub fn stack_impl(matrix: Matrix) -> syn::Result { 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 }) @@ -79,7 +79,7 @@ pub fn stack_impl(matrix: Matrix) -> syn::Result { 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 }) @@ -223,7 +223,7 @@ mod tests { matrix }}; - assert_eq!(format!("{}", result), format!("{}", expected)); + assert_eq!(format!("{result}"), format!("{}", expected)); } #[test] @@ -297,6 +297,6 @@ mod tests { matrix }}; - assert_eq!(format!("{}", result), format!("{}", expected)); + assert_eq!(format!("{result}"), format!("{}", expected)); } }