Skip to content

Commit

Permalink
Cleanup unused imports & bump Nix Flake (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
expede committed Mar 28, 2024
1 parent a00db2d commit a8d1b1d
Show file tree
Hide file tree
Showing 25 changed files with 56 additions and 95 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -8,7 +8,7 @@ include = ["/src", "/examples", "/benches", "README.md", "LICENSE"]
license = "Apache-2.0"
readme = "README.md"
edition = "2021"
rust-version = "1.75"
rust-version = "1.77"
documentation = "https://docs.rs/ucan"
repository = "https://github.com/ucan-wg/rs-ucan"
authors = [
Expand Down
36 changes: 18 additions & 18 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/ability/crud/update.rs
Expand Up @@ -7,7 +7,7 @@ use crate::{
};
use libipld_core::ipld::Ipld;
use serde::{Deserialize, Serialize};
use std::{collections::BTreeMap, path::PathBuf};
use std::path::PathBuf;
use thiserror::Error;

#[cfg_attr(doc, aquamarine::aquamarine)]
Expand Down
3 changes: 0 additions & 3 deletions src/ability/msg.rs
Expand Up @@ -17,9 +17,6 @@ use receive::{PromisedReceive, Receive};
use send::{PromisedSend, Send};
use serde::{Deserialize, Serialize};

#[cfg(feature = "test_utils")]
use proptest::prelude::*;

#[cfg(feature = "test_utils")]
use proptest_derive::Arbitrary;

Expand Down
2 changes: 1 addition & 1 deletion src/ability/ucan/assert.rs
@@ -1,6 +1,6 @@
use crate::ability::command::Command;
use crate::task::Task;
use libipld_core::{cid::Cid, ipld::Ipld};
use libipld_core::cid::Cid;

// Things that you can assert include content and receipts

Expand Down
1 change: 0 additions & 1 deletion src/ability/ucan/revoke.rs
Expand Up @@ -9,7 +9,6 @@ use crate::{
};
use libipld_core::{cid::Cid, ipld::Ipld};
use serde::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::fmt::Debug;

/// The fully resolved variant: ready to execute.
Expand Down
1 change: 0 additions & 1 deletion src/crypto/nonce.rs
Expand Up @@ -31,7 +31,6 @@ impl PartialEq for Nonce {
(Nonce::Custom(a), Nonce::Custom(b)) => a == b,
(Nonce::Custom(a), Nonce::Nonce16(b)) => a.as_slice() == b,
(Nonce::Nonce16(a), Nonce::Custom(b)) => a == b.as_slice(),
_ => false,
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/delegation/agent.rs
Expand Up @@ -68,7 +68,6 @@ where
now: SystemTime,
varsig_header: V,
) -> Result<Delegation<DID, V, C>, DelegateError<S::Error>> {
let mut salt = self.did.clone().to_string().into_bytes();
let nonce = Nonce::generate_16();

let (subject, policy) = match subject {
Expand Down
6 changes: 2 additions & 4 deletions src/delegation/payload.rs
Expand Up @@ -3,15 +3,13 @@ use crate::ability::arguments::Named;
use crate::time;
use crate::{
capsule::Capsule,
crypto::{varsig, Nonce},
crypto::Nonce,
did::{Did, Verifiable},
time::{TimeBoundError, Timestamp},
};
use core::str::FromStr;
use derive_builder::Builder;
use did_url::DID;
use libipld_core::{codec::Codec, error::SerdeError, ipld::Ipld, serde as ipld_serde};
use serde::{Deserialize, Serialize};
use libipld_core::ipld::Ipld;
use std::{collections::BTreeMap, fmt::Debug};
use thiserror::Error;
use web_time::SystemTime;
Expand Down
2 changes: 1 addition & 1 deletion src/delegation/policy/predicate.rs
Expand Up @@ -3,7 +3,7 @@ use super::selector::{Select, SelectorError};
use crate::ipld;
use enum_as_inner::EnumAsInner;
use libipld_core::ipld::Ipld;
use std::{fmt, str::FromStr};
use std::str::FromStr;
use thiserror::Error;

#[cfg(feature = "test_utils")]
Expand Down
11 changes: 1 addition & 10 deletions src/delegation/policy/selector.rs
Expand Up @@ -9,16 +9,7 @@ pub use select::Select;
pub use selectable::Selectable;

use filter::Filter;
use nom::{
self,
bytes::complete::tag,
character::complete::char,
combinator::map_res,
error::context,
multi::{many0, many1},
sequence::preceded,
IResult,
};
use nom::{self, character::complete::char, multi::many0, sequence::preceded};
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::cmp::Ordering;
use std::{fmt, str::FromStr};
Expand Down
6 changes: 3 additions & 3 deletions src/delegation/policy/selector/filter.rs
Expand Up @@ -4,8 +4,8 @@ use nom::{
self,
branch::alt,
bytes::complete::tag,
character::complete::{alphanumeric1, anychar, char, digit1},
combinator::{map_opt, map_res},
character::complete::{alphanumeric1, char, digit1},
combinator::map_res,
error::context,
multi::many1,
sequence::{delimited, preceded, terminated},
Expand Down Expand Up @@ -33,7 +33,7 @@ impl Filter {
(Filter::Values, Filter::Values) => true,
(Filter::ArrayIndex(_a), Filter::Values) => true,
(Filter::Field(_k), Filter::Values) => true,
(Filter::Try(a), Filter::Try(b)) => a.is_in(b), // FIXME Try is basically == null?
(Filter::Try(a), Filter::Try(b)) => a.is_in(b),
_ => false,
}
}
Expand Down
3 changes: 1 addition & 2 deletions src/delegation/policy/selector/select.rs
@@ -1,7 +1,6 @@
use super::Selector; // FIXME cycle?
use super::Selector;
use super::{error::SelectorErrorReason, filter::Filter, Selectable, SelectorError};
use libipld_core::ipld::Ipld;
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::fmt;
use std::str::FromStr;
Expand Down
8 changes: 4 additions & 4 deletions src/delegation/store/memory.rs
Expand Up @@ -10,8 +10,8 @@ use libipld_core::codec::Encode;
use libipld_core::ipld::Ipld;
use libipld_core::{cid::Cid, codec::Codec};
use nonempty::NonEmpty;
use std::borrow::Cow;
use std::{
borrow::Cow,
collections::{BTreeMap, BTreeSet},
convert::Infallible,
sync::{Arc, Mutex, MutexGuard},
Expand Down Expand Up @@ -160,7 +160,7 @@ where
let mut tx = self.lock();

tx.index
.entry(delegation.subject().clone())
.entry(delegation.subject().cloned())
.or_default()
.entry(delegation.audience().clone())
.or_default()
Expand All @@ -181,7 +181,7 @@ where
aud: &DID,
subject: &DID,
command: &str,
policy: Vec<Predicate>, // FIXME
policy: Vec<Predicate>,
now: SystemTime,
) -> Result<Option<NonEmpty<(Cid, Arc<Delegation<DID, V, Enc>>)>>, Self::Error> {
let blank_set = BTreeSet::new();
Expand Down Expand Up @@ -251,7 +251,7 @@ where
let issuer = delegation.issuer().clone();

// Hit a root delegation, AKA base case
if &Some(issuer.clone()) == delegation.subject() {
if Some(&issuer) == delegation.subject() {
break 'outer;
}

Expand Down
8 changes: 0 additions & 8 deletions src/did/key/signer.rs
Expand Up @@ -22,9 +22,6 @@ use crate::crypto::rs256;
#[cfg(feature = "rs512")]
use crate::crypto::rs512;

#[cfg(feature = "bls")]
use crate::crypto::bls12381;

/// Signer types that are verifiable by `did:key` [`Verifier`]s.
#[derive(Clone, EnumAsInner)]
pub enum Signer {
Expand Down Expand Up @@ -63,11 +60,6 @@ pub enum Signer {
/// `BLS 12-381` signer for the "min sig" variant.
#[cfg(feature = "bls")]
BlsMinSig(blst::min_sig::SecretKey),
// /// An unknown signer type.
// ///
// /// This is primarily for parsing, where reification is delayed
// /// until the DID method is known.
// FIXME rmeove Unknown(Vec<u8>),
}

impl signature::Signer<Signature> for Signer {
Expand Down
2 changes: 1 addition & 1 deletion src/did/preset.rs
Expand Up @@ -54,7 +54,7 @@ pub enum Signer {
impl std::fmt::Debug for Signer {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Signer::Key(signer) => write!(f, "Signer::Key(HIDDEN)"),
Signer::Key(_signer) => write!(f, "Signer::Key(HIDDEN)"),
}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/did/traits.rs
@@ -1,4 +1,3 @@
use did_url::DID;
use std::fmt;
use std::str::FromStr;

Expand Down
11 changes: 2 additions & 9 deletions src/invocation/agent.rs
Expand Up @@ -4,20 +4,13 @@ use super::{
Invocation,
};
use crate::{
ability::{
self, arguments,
arguments::Named,
command::ToCommand,
parse::{ParseAbility, ParseAbilityError},
ucan::revoke::Revoke,
},
ability::{self, arguments, arguments::Named, command::ToCommand, parse::ParseAbility},
crypto::{
signature::{self, Envelope},
varsig, Nonce,
},
delegation,
did::{self, Did},
invocation::payload::PayloadBuilder,
time::Timestamp,
};
use enum_as_inner::EnumAsInner;
Expand All @@ -26,7 +19,7 @@ use libipld_core::{
codec::{Codec, Encode},
ipld::Ipld,
};
use std::{collections::BTreeMap, fmt, marker::PhantomData};
use std::{collections::BTreeMap, marker::PhantomData};
use thiserror::Error;
use web_time::SystemTime;

Expand Down

0 comments on commit a8d1b1d

Please sign in to comment.