Skip to content

Commit

Permalink
Enable nightly rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Jan 12, 2024
1 parent 679a668 commit 36d5401
Show file tree
Hide file tree
Showing 77 changed files with 356 additions and 255 deletions.
3 changes: 2 additions & 1 deletion .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

cargo fmt --all -- --config format_code_in_doc_comments=true
rustup install nightly-2024-01-11
cargo +nightly-2024-01-11 fmt --all -- --config format_code_in_doc_comments=true

buildargs=(
"-p nostr"
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- run: cargo fmt --all -- --config format_code_in_doc_comments=true --check
- name: Toolchain
run: |
rustup install nightly-2024-01-11
rustup component add rustfmt --toolchain nightly-2024-01-11
- name: Format
run: cargo +nightly-2024-01-11 fmt --all -- --config format_code_in_doc_comments=true --check

build:
name: Build
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/event/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ impl From<nostr::EventBuilder> for EventBuilder {

impl Deref for EventBuilder {
type Target = nostr::EventBuilder;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/event/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub struct EventId {

impl Deref for EventId {
type Target = nostr::EventId;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ impl From<EventSdk> for Event {

impl Deref for Event {
type Target = EventSdk;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
5 changes: 3 additions & 2 deletions bindings/nostr-ffi/src/event/tag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ use crate::error::{NostrError, Result};
use crate::nips::nip48::Protocol;
use crate::nips::nip53::LiveEventMarker;
use crate::nips::nip90::DataVendingMachineStatus;
use crate::Event;
use crate::{EventId, ImageDimensions, LiveEventStatus, PublicKey, Timestamp};
use crate::{Event, EventId, ImageDimensions, LiveEventStatus, PublicKey, Timestamp};

/// Marker
#[derive(Enum)]
Expand Down Expand Up @@ -739,6 +738,7 @@ impl From<tag::Tag> for TagEnum {

impl TryFrom<TagEnum> for tag::Tag {
type Error = NostrError;

fn try_from(value: TagEnum) -> Result<Self, Self::Error> {
match value {
TagEnum::Unknown { kind, data } => Ok(Self::Generic(kind.into(), data)),
Expand Down Expand Up @@ -893,6 +893,7 @@ impl From<tag::Tag> for Tag {

impl Deref for Tag {
type Target = tag::Tag;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/key/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ pub struct Keys {

impl Deref for Keys {
type Target = key::Keys;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/key/public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ impl From<&PublicKey> for XOnlyPublicKey {

impl Deref for PublicKey {
type Target = XOnlyPublicKey;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/key/secret_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ impl From<Sk> for SecretKey {

impl Deref for SecretKey {
type Target = Sk;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/message/subscription.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub struct Filter {

impl Deref for Filter {
type Target = nostr::Filter;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/nips/nip15.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ pub struct ShippingMethod {

impl Deref for ShippingMethod {
type Target = nip15::ShippingMethod;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/nips/nip46.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ impl From<nip46::NostrConnectURI> for NostrConnectURI {

impl Deref for NostrConnectURI {
type Target = nip46::NostrConnectURI;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/nips/nip57.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct ZapRequestData {

impl Deref for ZapRequestData {
type Target = nip57::ZapRequestData;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/nips/nip94.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub struct FileMetadata {

impl Deref for FileMetadata {
type Target = nip94::FileMetadata;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/types/contact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct Contact {

impl Deref for Contact {
type Target = nostr::Contact;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/types/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub struct Metadata {

impl Deref for Metadata {
type Target = nostr::Metadata;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-ffi/src/types/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ impl From<nostr::Timestamp> for Timestamp {

impl Deref for Timestamp {
type Target = nostr::Timestamp;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-js/src/event/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct JsEventBuilder {

impl Deref for JsEventBuilder {
type Target = EventBuilder;

fn deref(&self) -> &Self::Target {
&self.builder
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-js/src/event/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct JsEventId {

impl Deref for JsEventId {
type Target = EventId;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-js/src/event/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl From<Event> for JsEvent {

impl Deref for JsEvent {
type Target = Event;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-js/src/key/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct JsKeys {

impl Deref for JsKeys {
type Target = Keys;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-js/src/key/public_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct JsPublicKey {

impl Deref for JsPublicKey {
type Target = XOnlyPublicKey;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-js/src/key/secret_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub struct JsSecretKey {

impl Deref for JsSecretKey {
type Target = SecretKey;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-js/src/nips/nip07.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub struct JsNip07Signer {

impl Deref for JsNip07Signer {
type Target = Nip07Signer;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-js/src/types/contact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct JsContact {

impl Deref for JsContact {
type Target = Contact;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-js/src/types/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ impl From<Metadata> for JsMetadata {

impl Deref for JsMetadata {
type Target = Metadata;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-js/src/types/time.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ impl From<Timestamp> for JsTimestamp {

impl Deref for JsTimestamp {
type Target = Timestamp;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-sdk-ffi/src/client/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ pub struct Options {

impl Deref for Options {
type Target = nostr_sdk::Options;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-sdk-ffi/src/client/signer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ pub struct ClientSigner {

impl Deref for ClientSigner {
type Target = signer::ClientSigner;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
1 change: 1 addition & 0 deletions bindings/nostr-sdk-ffi/src/client/signer/nip46.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct Nip46Signer {

impl Deref for Nip46Signer {
type Target = client::Nip46Signer;

fn deref(&self) -> &Self::Target {
&self.inner
}
Expand Down
3 changes: 2 additions & 1 deletion bindings/nostr-sdk-ffi/src/relay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
// Copyright (c) 2023-2024 Rust Nostr Developers
// Distributed under the MIT software license

use std::collections::HashMap;
use std::ops::Deref;
use std::sync::Arc;
use std::time::Duration;
use std::{collections::HashMap, ops::Deref};

use nostr_ffi::{ClientMessage, Event, Filter, RelayInformationDocument, Timestamp};
use nostr_sdk::{block_on, relay, FilterOptions};
Expand Down
4 changes: 2 additions & 2 deletions bindings/nostr-sdk-js/src/client/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
use std::ops::Deref;
use std::sync::Arc;

use nostr_sdk::ClientBuilder;
use nostr_sdk::{database::DynNostrDatabase, Client};
use nostr_sdk::database::DynNostrDatabase;
use nostr_sdk::{Client, ClientBuilder};
use wasm_bindgen::prelude::*;

use super::{JsClient, JsClientSigner};
Expand Down
Loading

0 comments on commit 36d5401

Please sign in to comment.