From 870f191a13939c6697c3723852dc4e55ad8080a4 Mon Sep 17 00:00:00 2001 From: William Casarin Date: Thu, 28 Nov 2024 09:57:16 -0800 Subject: [PATCH] rustfmt and clippy time Signed-off-by: William Casarin --- build.rs | 18 +++++++++--------- src/bindings.rs | 5 ++--- src/block.rs | 2 +- src/filter.rs | 2 +- src/note.rs | 8 ++++---- src/util/nip10.rs | 2 +- 6 files changed, 18 insertions(+), 19 deletions(-) diff --git a/build.rs b/build.rs index 50f608f..88d9e55 100644 --- a/build.rs +++ b/build.rs @@ -1,4 +1,4 @@ -// build.rs +// build.rs use cc::Build; use std::env; use std::path::PathBuf; @@ -42,7 +42,7 @@ fn secp256k1_build() { /// bolt11 deps with portability issues, exclude these on windows build fn bolt11_deps() -> &'static [&'static str] { - return &[ + &[ "nostrdb/ccan/ccan/likely/likely.c", "nostrdb/ccan/ccan/list/list.c", "nostrdb/ccan/ccan/mem/mem.c", @@ -52,7 +52,6 @@ fn bolt11_deps() -> &'static [&'static str] { "nostrdb/ccan/ccan/tal/str/str.c", "nostrdb/ccan/ccan/tal/tal.c", "nostrdb/ccan/ccan/utf8/utf8.c", - "nostrdb/src/bolt11/bolt11.c", "nostrdb/src/bolt11/amount.c", "nostrdb/src/bolt11/hash_u5.c", @@ -86,18 +85,19 @@ fn main() { .include("nostrdb/deps/secp256k1/include") .include("nostrdb/ccan") .include("nostrdb/src"); - // Add other include paths - //.flag("-Wall") + // Add other include paths + //.flag("-Wall") //.flag("-Werror") //.flag("-g") // Link Security framework on macOS if !cfg!(target_os = "windows") { build.files(bolt11_deps()); - build.flag("-Wno-sign-compare") - .flag("-Wno-misleading-indentation") - .flag("-Wno-unused-function") - .flag("-Wno-unused-parameter"); + build + .flag("-Wno-sign-compare") + .flag("-Wno-misleading-indentation") + .flag("-Wno-unused-function") + .flag("-Wno-unused-parameter"); } else { // need this on windows println!("cargo:rustc-link-lib=bcrypt"); diff --git a/src/bindings.rs b/src/bindings.rs index f3841aa..76f0a1c 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -1,6 +1,5 @@ - #[cfg(target_os = "windows")] -include!{"bindings_win.rs"} +include! {"bindings_win.rs"} #[cfg(not(target_os = "windows"))] -include!{"bindings_posix.rs"} +include! {"bindings_posix.rs"} diff --git a/src/block.rs b/src/block.rs index 932a785..99e350a 100644 --- a/src/block.rs +++ b/src/block.rs @@ -221,7 +221,7 @@ impl<'a> Blocks<'a> { } } -impl<'a> Drop for Blocks<'a> { +impl Drop for Blocks<'_> { fn drop(&mut self) { unsafe { bindings::ndb_blocks_free(self.as_ptr()) }; } diff --git a/src/filter.rs b/src/filter.rs index 6022881..a84b698 100644 --- a/src/filter.rs +++ b/src/filter.rs @@ -1008,7 +1008,7 @@ impl<'a> IntoIterator for FilterIntElements<'a> { } } -impl<'a> Iterator for FilterIntElemIter<'a> { +impl Iterator for FilterIntElemIter<'_> { type Item = u64; fn next(&mut self) -> Option { diff --git a/src/note.rs b/src/note.rs index 7be6bba..6e1008e 100644 --- a/src/note.rs +++ b/src/note.rs @@ -25,7 +25,7 @@ pub struct NoteBuildOptions<'a> { pub sign_key: Option<&'a [u8; 32]>, } -impl<'a> Default for NoteBuildOptions<'a> { +impl Default for NoteBuildOptions<'_> { fn default() -> Self { NoteBuildOptions { set_created_at: true, @@ -69,7 +69,7 @@ pub enum Note<'a> { }, } -impl<'a> Clone for Note<'a> { +impl Clone for Note<'_> { fn clone(&self) -> Self { // TODO (jb55): it is still probably better to just separate owned notes // into NoteBuf... that way we know exactly what we are cloning @@ -250,7 +250,7 @@ impl<'a> Note<'a> { } } -impl<'a> Drop for Note<'a> { +impl Drop for Note<'_> { fn drop(&mut self) { if let Note::Owned { ptr, .. } = self { unsafe { libc::free((*ptr) as *mut libc::c_void) } @@ -309,7 +309,7 @@ pub struct NoteBuilder<'a> { options: NoteBuildOptions<'a>, } -impl<'a> Default for NoteBuilder<'a> { +impl Default for NoteBuilder<'_> { fn default() -> Self { NoteBuilder::new() } diff --git a/src/util/nip10.rs b/src/util/nip10.rs index e886aca..c6a2d3f 100644 --- a/src/util/nip10.rs +++ b/src/util/nip10.rs @@ -16,7 +16,7 @@ pub struct NoteIdRef<'a> { pub marker: Option, } -impl<'a> NoteIdRef<'a> { +impl NoteIdRef<'_> { pub fn to_owned(&self) -> NoteIdRefBuf { NoteIdRefBuf { index: self.index,