From 6019cd3a78cc0dd73efb8b15166a154f5fcef030 Mon Sep 17 00:00:00 2001 From: Ian Chamberlain Date: Mon, 13 May 2024 21:59:30 -0400 Subject: [PATCH] Minor clippy fixups --- ctru-sys/build/test_gen.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/ctru-sys/build/test_gen.rs b/ctru-sys/build/test_gen.rs index d8179c92..db0c97c5 100644 --- a/ctru-sys/build/test_gen.rs +++ b/ctru-sys/build/test_gen.rs @@ -109,7 +109,7 @@ impl LayoutTestGenerator { // the `#include` directives (they would be missing whitespace/newlines), // so we basically need to drop in the include headers here "manually" by // writing them into the cpp! macro invocation. - file.write_all("cpp! {{".as_bytes())?; + file.write_all("cpp! {{\n".as_bytes())?; for included_file in self.headers.borrow().iter() { writeln!(file, " #include \"{included_file}\"")?; } @@ -147,12 +147,12 @@ impl LayoutTestGenerator { let mut field_tests = Vec::new(); field_tests.push(build_assert_eq( - quote!(size_of!(#name)), - quote!(sizeof(#name)), + "e!(size_of!(#name)), + "e!(sizeof(#name)), )); field_tests.push(build_assert_eq( - quote!(align_of!(#name)), - quote!(alignof(#name)), + "e!(align_of!(#name)), + "e!(alignof(#name)), )); let struct_fields = self.struct_fields.borrow(); @@ -176,18 +176,18 @@ impl LayoutTestGenerator { let field = format_ident!("{field}"); field_tests.push(build_assert_eq( - quote!(size_of!(#name::#field)), - quote!(sizeof(#name::#field)), + "e!(size_of!(#name::#field)), + "e!(sizeof(#name::#field)), )); field_tests.push(build_assert_eq( - quote!(align_of!(#name::#field)), - quote!(alignof(#name::#field)), + "e!(align_of!(#name::#field)), + "e!(alignof(#name::#field)), )); field_tests.push(build_assert_eq( - quote!(offset_of!(#name, #field)), - quote!(offsetof(#name, #field)), + "e!(offset_of!(#name, #field)), + "e!(offsetof(#name, #field)), )); } } @@ -201,7 +201,7 @@ impl LayoutTestGenerator { } } -fn build_assert_eq(rust_lhs: TokenStream, cpp_rhs: TokenStream) -> TokenStream { +fn build_assert_eq(rust_lhs: &TokenStream, cpp_rhs: &TokenStream) -> TokenStream { quote! { assert_eq!( #rust_lhs,