Skip to content

Commit

Permalink
rustfmt and clippy time
Browse files Browse the repository at this point in the history
Signed-off-by: William Casarin <[email protected]>
  • Loading branch information
jb55 committed Nov 28, 2024
1 parent ad45c6a commit 870f191
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 19 deletions.
18 changes: 9 additions & 9 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// build.rs
// build.rs
use cc::Build;
use std::env;
use std::path::PathBuf;
Expand Down Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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");
Expand Down
5 changes: 2 additions & 3 deletions src/bindings.rs
Original file line number Diff line number Diff line change
@@ -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"}
2 changes: 1 addition & 1 deletion src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()) };
}
Expand Down
2 changes: 1 addition & 1 deletion src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<u64> {
Expand Down
8 changes: 4 additions & 4 deletions src/note.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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) }
Expand Down Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion src/util/nip10.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub struct NoteIdRef<'a> {
pub marker: Option<Marker>,
}

impl<'a> NoteIdRef<'a> {
impl NoteIdRef<'_> {
pub fn to_owned(&self) -> NoteIdRefBuf {
NoteIdRefBuf {
index: self.index,
Expand Down

0 comments on commit 870f191

Please sign in to comment.