Skip to content

Commit

Permalink
fix for older Rust
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelcolvin committed Jun 6, 2024
1 parent 726ef6f commit d5c83a2
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions crates/jiter/src/py_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,22 @@ pub(crate) trait MaybeBuildObjectPath: MaybeBuildPath {
}

pub(crate) trait MaybeBuildPath {
fn new_array() -> impl MaybeBuildArrayPath;
fn new_object() -> impl MaybeBuildObjectPath;
type A: MaybeBuildArrayPath;
type O: MaybeBuildObjectPath;
fn new_array() -> Self::A;
fn new_object() -> Self::O;
}

pub(crate) struct NoopBuildPath;

impl MaybeBuildPath for NoopBuildPath {
fn new_array() -> NoopBuildPath {
type A = NoopBuildPath;
type O = NoopBuildPath;
fn new_array() -> Self::A {
NoopBuildPath
}

fn new_object() -> NoopBuildPath {
fn new_object() -> Self::O {
NoopBuildPath
}
}
Expand All @@ -117,11 +121,13 @@ pub(crate) struct ActiveBuildPath {
}

impl MaybeBuildPath for ActiveBuildPath {
fn new_array() -> ActiveBuildPath {
type A = ActiveBuildPath;
type O = ActiveObjectBuildPath;
fn new_array() -> Self::A {
ActiveBuildPath::default()
}

fn new_object() -> ActiveObjectBuildPath {
fn new_object() -> Self::O {
ActiveObjectBuildPath::default()
}
}
Expand All @@ -143,11 +149,13 @@ pub(crate) struct ActiveObjectBuildPath {
}

impl MaybeBuildPath for ActiveObjectBuildPath {
fn new_array() -> ActiveBuildPath {
type A = ActiveBuildPath;
type O = ActiveObjectBuildPath;
fn new_array() -> Self::A {
ActiveBuildPath::default()
}

Check warning on line 156 in crates/jiter/src/py_error.rs

View check run for this annotation

Codecov / codecov/patch

crates/jiter/src/py_error.rs#L154-L156

Added lines #L154 - L156 were not covered by tests

fn new_object() -> ActiveObjectBuildPath {
fn new_object() -> Self::O {
ActiveObjectBuildPath::default()
}

Check warning on line 160 in crates/jiter/src/py_error.rs

View check run for this annotation

Codecov / codecov/patch

crates/jiter/src/py_error.rs#L158-L160

Added lines #L158 - L160 were not covered by tests
}
Expand Down

0 comments on commit d5c83a2

Please sign in to comment.