Skip to content

Commit ee76b9e

Browse files
committed
Fix clippy::toplevel_ref_arg at stack! callsites
`let x = &y` is preferred over `let ref x = y`
1 parent 96c5d87 commit ee76b9e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

nalgebra-macros/src/stack_impl.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pub fn stack_impl(matrix: Matrix) -> syn::Result<TokenStream2> {
2626
let ident_block = format_ident!("{prefix}_stack_{i}_{j}_block");
2727
let ident_shape = format_ident!("{prefix}_stack_{i}_{j}_shape");
2828
output.extend(std::iter::once(quote_spanned! {expr.span()=>
29-
let ref #ident_block = #expr;
29+
let #ident_block = &(#expr);
3030
let #ident_shape = #ident_block.shape_generic();
3131
}));
3232
}
@@ -194,9 +194,9 @@ mod tests {
194194
let result = stack_impl(input).unwrap();
195195

196196
let expected = quote! {{
197-
let ref ___na_stack_0_0_block = a;
197+
let ___na_stack_0_0_block = & (a);
198198
let ___na_stack_0_0_shape = ___na_stack_0_0_block.shape_generic();
199-
let ref ___na_stack_1_1_block = b;
199+
let ___na_stack_1_1_block = & (b);
200200
let ___na_stack_1_1_shape = ___na_stack_1_1_block.shape_generic();
201201
let ___na_stack_row_0_dim = ___na_stack_0_0_shape.0;
202202
let ___na_stack_row_0_offset = 0;
@@ -237,15 +237,15 @@ mod tests {
237237
let result = stack_impl(input).unwrap();
238238

239239
let expected = quote! {{
240-
let ref ___na_stack_0_0_block = a;
240+
let ___na_stack_0_0_block = & (a);
241241
let ___na_stack_0_0_shape = ___na_stack_0_0_block.shape_generic();
242-
let ref ___na_stack_0_2_block = b;
242+
let ___na_stack_0_2_block = & (b);
243243
let ___na_stack_0_2_shape = ___na_stack_0_2_block.shape_generic();
244-
let ref ___na_stack_1_1_block = c;
244+
let ___na_stack_1_1_block = & (c);
245245
let ___na_stack_1_1_shape = ___na_stack_1_1_block.shape_generic();
246-
let ref ___na_stack_1_2_block = d;
246+
let ___na_stack_1_2_block = & (d);
247247
let ___na_stack_1_2_shape = ___na_stack_1_2_block.shape_generic();
248-
let ref ___na_stack_2_0_block = e;
248+
let ___na_stack_2_0_block = & (e);
249249
let ___na_stack_2_0_shape = ___na_stack_2_0_block.shape_generic();
250250
let ___na_stack_row_0_dim = < nalgebra :: constraint :: ShapeConstraint as nalgebra :: constraint :: SameNumberOfRows < _ , _ >> :: representative (___na_stack_0_0_shape . 0 , ___na_stack_0_2_shape . 0) . expect ("All blocks in block row 0 must have the same number of rows") ;
251251
let ___na_stack_row_0_offset = 0;

0 commit comments

Comments
 (0)