Skip to content

Commit

Permalink
pleasing cargo fmt after upgrading to 1.83
Browse files Browse the repository at this point in the history
  • Loading branch information
pchampin committed Nov 29, 2024
1 parent b6d5df4 commit c8ec3e4
Show file tree
Hide file tree
Showing 28 changed files with 216 additions and 55 deletions.
15 changes: 12 additions & 3 deletions api/src/dataset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,10 @@ mod check_implementability {
}

impl Dataset for MyDataset {
type Quad<'x> = [SimpleTerm<'x>; 4] where Self: 'x;
type Quad<'x>
= [SimpleTerm<'x>; 4]
where
Self: 'x;
type Error = std::convert::Infallible;

fn quads(&self) -> impl Iterator<Item = DResult<Self, Self::Quad<'_>>> + '_ {
Expand Down Expand Up @@ -691,7 +694,10 @@ mod check_implementability_lazy_term {
}

impl<'a> Term for MyTerm<'a> {
type BorrowTerm<'x> = MyTerm<'x> where Self: 'x;
type BorrowTerm<'x>
= MyTerm<'x>
where
Self: 'x;

fn kind(&self) -> crate::term::TermKind {
if let Atom(t) = &self.dataset.terms[self.index] {
Expand Down Expand Up @@ -770,7 +776,10 @@ mod check_implementability_lazy_term {
}

impl Dataset for MyDataset {
type Quad<'x> = [MyTerm<'x>; 4] where Self: 'x;
type Quad<'x>
= [MyTerm<'x>; 4]
where
Self: 'x;
type Error = std::convert::Infallible;

fn quads(&self) -> impl Iterator<Item = DResult<Self, Self::Quad<'_>>> + '_ {
Expand Down
30 changes: 24 additions & 6 deletions api/src/dataset/_foreign_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use std::hash::{BuildHasher, Hash};
// reference to Dataset

impl<'a, T: Dataset + ?Sized> Dataset for &'a T {
type Quad<'x> = T::Quad<'x> where Self: 'x;
type Quad<'x>
= T::Quad<'x>
where
Self: 'x;

type Error = T::Error;

Expand Down Expand Up @@ -89,7 +92,10 @@ impl<'a, T: Dataset + ?Sized> Dataset for &'a T {

// NB: this one is required so that &'a mut T can also implement MutableDataset
impl<'a, T: Dataset + ?Sized> Dataset for &'a mut T {
type Quad<'x> = T::Quad<'x> where Self: 'x;
type Quad<'x>
= T::Quad<'x>
where
Self: 'x;

type Error = T::Error;

Expand Down Expand Up @@ -255,7 +261,10 @@ impl<T: MutableDataset + ?Sized> MutableDataset for &mut T {

impl<Q: Quad> Dataset for [Q] {
type Error = Infallible;
type Quad<'x> = Spog<QBorrowTerm<'x, Q>> where Self: 'x;
type Quad<'x>
= Spog<QBorrowTerm<'x, Q>>
where
Self: 'x;

fn quads(&self) -> impl Iterator<Item = DResult<Self, Self::Quad<'_>>> + '_ {
self.iter().map(Quad::spog).map(Ok)
Expand All @@ -266,7 +275,10 @@ impl<Q: Quad> Dataset for [Q] {

impl<Q: Quad> Dataset for Vec<Q> {
type Error = Infallible;
type Quad<'x> = Spog<QBorrowTerm<'x, Q>> where Self: 'x;
type Quad<'x>
= Spog<QBorrowTerm<'x, Q>>
where
Self: 'x;

fn quads(&self) -> impl Iterator<Item = DResult<Self, Self::Quad<'_>>> + '_ {
self[..].quads()
Expand Down Expand Up @@ -427,7 +439,10 @@ where

impl<Q: Quad, S> Dataset for HashSet<Q, S> {
type Error = Infallible;
type Quad<'x> = Spog<QBorrowTerm<'x, Q>> where Self: 'x;
type Quad<'x>
= Spog<QBorrowTerm<'x, Q>>
where
Self: 'x;

fn quads(&self) -> impl Iterator<Item = DResult<Self, Self::Quad<'_>>> + '_ {
self.iter().map(Quad::spog).map(Ok)
Expand Down Expand Up @@ -579,7 +594,10 @@ impl<T: Quad, S> SetDataset for HashSet<T, S> {}
/// nor other methods.
impl<Q: Quad> Dataset for BTreeSet<Q> {
type Error = Infallible;
type Quad<'x> = Spog<QBorrowTerm<'x, Q>> where Self: 'x;
type Quad<'x>
= Spog<QBorrowTerm<'x, Q>>
where
Self: 'x;

fn quads(&self) -> impl Iterator<Item = DResult<Self, Self::Quad<'_>>> + '_ {
self.iter().map(Quad::spog).map(Ok)
Expand Down
5 changes: 4 additions & 1 deletion api/src/dataset/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ impl<T> Dataset for GraphAsDataset<T>
where
T: Graph,
{
type Quad<'x> = Spog<GTerm<'x, T>> where Self: 'x;
type Quad<'x>
= Spog<GTerm<'x, T>>
where
Self: 'x;
type Error = T::Error;

fn quads(&self) -> impl Iterator<Item = DResult<Self, Self::Quad<'_>>> + '_ {
Expand Down
15 changes: 12 additions & 3 deletions api/src/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,10 @@ mod check_implementability {
}

impl Graph for MyGraph {
type Triple<'x> = [SimpleTerm<'x>; 3] where Self: 'x;
type Triple<'x>
= [SimpleTerm<'x>; 3]
where
Self: 'x;
type Error = std::convert::Infallible;

fn triples(&self) -> impl Iterator<Item = GResult<Self, Self::Triple<'_>>> + '_ {
Expand Down Expand Up @@ -620,7 +623,10 @@ mod check_implementability_lazy_term {
}

impl<'a> Term for MyTerm<'a> {
type BorrowTerm<'x> = MyTerm<'x> where Self: 'x;
type BorrowTerm<'x>
= MyTerm<'x>
where
Self: 'x;

fn kind(&self) -> crate::term::TermKind {
if let Atom(t) = &self.graph.terms[self.index] {
Expand Down Expand Up @@ -699,7 +705,10 @@ mod check_implementability_lazy_term {
}

impl Graph for MyGraph {
type Triple<'x> = [MyTerm<'x>; 3] where Self: 'x;
type Triple<'x>
= [MyTerm<'x>; 3]
where
Self: 'x;

type Error = std::convert::Infallible;

Expand Down
30 changes: 24 additions & 6 deletions api/src/graph/_foreign_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ use std::hash::{BuildHasher, Hash};
// reference to Graph

impl<'a, T: Graph + ?Sized> Graph for &'a T {
type Triple<'x> = T::Triple<'x> where Self: 'x;
type Triple<'x>
= T::Triple<'x>
where
Self: 'x;

type Error = T::Error;

Expand Down Expand Up @@ -82,7 +85,10 @@ impl<'a, T: Graph + ?Sized> Graph for &'a T {

// NB: this one is required so that &'a mut T can also implement MutableDataset
impl<'a, T: Graph + ?Sized> Graph for &'a mut T {
type Triple<'x> = T::Triple<'x> where Self: 'x;
type Triple<'x>
= T::Triple<'x>
where
Self: 'x;

type Error = T::Error;

Expand Down Expand Up @@ -214,7 +220,10 @@ impl<'a, T: MutableGraph + ?Sized> MutableGraph for &'a mut T {

impl<T: Triple> Graph for [T] {
type Error = Infallible;
type Triple<'x> = [TBorrowTerm<'x, T>; 3] where Self: 'x;
type Triple<'x>
= [TBorrowTerm<'x, T>; 3]
where
Self: 'x;

fn triples(&self) -> impl Iterator<Item = GResult<Self, Self::Triple<'_>>> + '_ {
self.iter().map(Triple::spo).map(Ok)
Expand All @@ -225,7 +234,10 @@ impl<T: Triple> Graph for [T] {

impl<T: Triple> Graph for Vec<T> {
type Error = Infallible;
type Triple<'x> = [TBorrowTerm<'x, T>; 3] where Self: 'x;
type Triple<'x>
= [TBorrowTerm<'x, T>; 3]
where
Self: 'x;

fn triples(&self) -> impl Iterator<Item = GResult<Self, Self::Triple<'_>>> + '_ {
self[..].triples()
Expand Down Expand Up @@ -289,7 +301,10 @@ where

impl<T: Triple, S> Graph for HashSet<T, S> {
type Error = Infallible;
type Triple<'x> = [TBorrowTerm<'x, T>; 3] where Self: 'x;
type Triple<'x>
= [TBorrowTerm<'x, T>; 3]
where
Self: 'x;

fn triples(&self) -> impl Iterator<Item = GResult<Self, Self::Triple<'_>>> + '_ {
self.iter().map(Triple::spo).map(Ok)
Expand Down Expand Up @@ -350,7 +365,10 @@ impl<T: Triple, S> SetGraph for HashSet<T, S> {}
/// nor other methods.
impl<T: Triple> Graph for BTreeSet<T> {
type Error = Infallible;
type Triple<'x> = [TBorrowTerm<'x, T>; 3] where Self: 'x;
type Triple<'x>
= [TBorrowTerm<'x, T>; 3]
where
Self: 'x;

fn triples(&self) -> impl Iterator<Item = GResult<Self, Self::Triple<'_>>> + '_ {
self.iter().map(Triple::spo).map(Ok)
Expand Down
15 changes: 12 additions & 3 deletions api/src/graph/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ impl<T: Dataset> UnionGraph<T> {
}

impl<T: Dataset> Graph for UnionGraph<T> {
type Triple<'x> = [DTerm<'x, T>; 3] where Self: 'x;
type Triple<'x>
= [DTerm<'x, T>; 3]
where
Self: 'x;
type Error = T::Error;

fn triples(&self) -> impl Iterator<Item = GResult<Self, Self::Triple<'_>>> + '_ {
Expand Down Expand Up @@ -115,7 +118,10 @@ impl<D: Dataset, M: GraphNameMatcher + Copy> PartialUnionGraph<D, M> {
}

impl<D: Dataset, M: GraphNameMatcher + Copy> Graph for PartialUnionGraph<D, M> {
type Triple<'x> = [DTerm<'x, D>; 3] where Self: 'x;
type Triple<'x>
= [DTerm<'x, D>; 3]
where
Self: 'x;
type Error = D::Error;

fn triples(&self) -> impl Iterator<Item = GResult<Self, Self::Triple<'_>>> + '_ {
Expand Down Expand Up @@ -180,7 +186,10 @@ impl<D: Dataset, G: Term> DatasetGraph<D, G> {
}

impl<D: Dataset, G: Term> Graph for DatasetGraph<D, G> {
type Triple<'x> = [DTerm<'x, D>; 3] where Self: 'x;
type Triple<'x>
= [DTerm<'x, D>; 3]
where
Self: 'x;
type Error = D::Error;

fn triples(&self) -> impl Iterator<Item = GResult<Self, Self::Triple<'_>>> + '_ {
Expand Down
5 changes: 4 additions & 1 deletion api/src/ns/_term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,10 @@ impl<'a> NsTerm<'a> {
}

impl<'a> Term for NsTerm<'a> {
type BorrowTerm<'x> = &'x Self where 'a: 'x;
type BorrowTerm<'x>
= &'x Self
where
'a: 'x;

fn kind(&self) -> TermKind {
TermKind::Iri
Expand Down
5 changes: 4 additions & 1 deletion api/src/term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,10 @@ impl<'a, T> Term for &'a T
where
T: Term<BorrowTerm<'a> = &'a T> + ?Sized,
{
type BorrowTerm<'x> = Self where 'a: 'x;
type BorrowTerm<'x>
= Self
where
'a: 'x;

fn kind(&self) -> TermKind {
(*self).kind()
Expand Down
5 changes: 4 additions & 1 deletion api/src/term/_cmp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ use super::*;
pub struct CmpTerm<T>(pub T);

impl<T: Term> Term for CmpTerm<T> {
type BorrowTerm<'x> = CmpTerm<T::BorrowTerm<'x>> where T: 'x;
type BorrowTerm<'x>
= CmpTerm<T::BorrowTerm<'x>>
where
T: 'x;

fn kind(&self) -> TermKind {
self.0.kind()
Expand Down
10 changes: 8 additions & 2 deletions api/src/term/_native_iri.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ impl<T> Term for Iri<T>
where
T: Borrow<str>,
{
type BorrowTerm<'x> = &'x Self where T: 'x;
type BorrowTerm<'x>
= &'x Self
where
T: 'x;

fn kind(&self) -> TermKind {
TermKind::Iri
Expand All @@ -24,7 +27,10 @@ impl<T> Term for IriRef<T>
where
T: Borrow<str>,
{
type BorrowTerm<'x> = &'x Self where T: 'x;
type BorrowTerm<'x>
= &'x Self
where
T: 'x;

fn kind(&self) -> TermKind {
TermKind::Iri
Expand Down
5 changes: 4 additions & 1 deletion api/src/term/_native_literal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ impl Term for usize {
/// # Ok(()) }
/// ```
impl Term for str {
type BorrowTerm<'x> = &'x Self where Self: 'x;
type BorrowTerm<'x>
= &'x Self
where
Self: 'x;

fn kind(&self) -> TermKind {
TermKind::Literal
Expand Down
5 changes: 4 additions & 1 deletion api/src/term/_simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ pub enum SimpleTerm<'a> {
use SimpleTerm::*;

impl<'a> Term for SimpleTerm<'a> {
type BorrowTerm<'x> = &'x Self where 'a: 'x;
type BorrowTerm<'x>
= &'x Self
where
'a: 'x;

fn kind(&self) -> TermKind {
match self {
Expand Down
5 changes: 4 additions & 1 deletion api/src/term/bnode_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@ impl<T> Term for BnodeId<T>
where
T: Borrow<str>,
{
type BorrowTerm<'x> = &'x Self where T: 'x;
type BorrowTerm<'x>
= &'x Self
where
T: 'x;

fn kind(&self) -> TermKind {
TermKind::BlankNode
Expand Down
5 changes: 4 additions & 1 deletion api/src/term/var_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ impl<T> Term for VarName<T>
where
T: Borrow<str>,
{
type BorrowTerm<'x> = &'x Self where T: 'x;
type BorrowTerm<'x>
= &'x Self
where
T: 'x;

fn kind(&self) -> TermKind {
TermKind::Variable
Expand Down
5 changes: 4 additions & 1 deletion c14n/src/_c14n_term.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ pub enum C14nTerm<T: Term> {
use C14nTerm::{Blank, Other};

impl<T: Term> Term for C14nTerm<T> {
type BorrowTerm<'x> = &'x Self where Self: 'x;
type BorrowTerm<'x>
= &'x Self
where
Self: 'x;

fn kind(&self) -> sophia_api::term::TermKind {
match self {
Expand Down
Loading

0 comments on commit c8ec3e4

Please sign in to comment.