Skip to content

Commit

Permalink
Merge pull request #277 from palantir/dependabot/cargo/educe-0.5
Browse files Browse the repository at this point in the history
Update educe requirement from 0.4 to 0.5
  • Loading branch information
sfackler committed Feb 3, 2024
2 parents d1f4067 + 9417104 commit 0806f62
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 89 deletions.
7 changes: 3 additions & 4 deletions conjure-codegen/src/aliases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ pub fn generate(ctx: &Context, def: &AliasDefinition) -> TokenStream {
type_attrs.push(quote!(#[educe(PartialEq, Eq, PartialOrd, Ord, Hash)]));
field_attrs.push(quote! {
#[educe(
PartialEq(trait = "conjure_object::private::DoubleOps"),
PartialOrd(trait = "conjure_object::private::DoubleOps"),
Ord(trait = "conjure_object::private::DoubleOps"),
Hash(trait = "conjure_object::private::DoubleOps"),
PartialEq(method(conjure_object::private::DoubleOps::eq)),
Ord(method(conjure_object::private::DoubleOps::cmp)),
Hash(method(conjure_object::private::DoubleOps::hash)),
)]
})
} else {
Expand Down

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

7 changes: 3 additions & 4 deletions conjure-codegen/src/example_types/product/double_example.rs

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

7 changes: 3 additions & 4 deletions conjure-codegen/src/example_types/product/list_example.rs

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

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

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

7 changes: 3 additions & 4 deletions conjure-codegen/src/objects/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,9 @@ pub fn generate(ctx: &Context, def: &ObjectDefinition) -> TokenStream {
if ctx.is_double(s.type_()) {
quote! {
#[educe(
PartialEq(trait = "conjure_object::private::DoubleOps"),
PartialOrd(trait = "conjure_object::private::DoubleOps"),
Ord(trait = "conjure_object::private::DoubleOps"),
Hash(trait = "conjure_object::private::DoubleOps"),
PartialEq(method(conjure_object::private::DoubleOps::eq)),
Ord(method(conjure_object::private::DoubleOps::cmp)),
Hash(method(conjure_object::private::DoubleOps::hash)),
)]
}
} else {
Expand Down
7 changes: 3 additions & 4 deletions conjure-codegen/src/unions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ fn generate_enum(ctx: &Context, def: &UnionDefinition) -> TokenStream {
let attr = if ctx.is_double(f.type_()) {
quote! {
#[educe(
PartialEq(trait = "conjure_object::private::DoubleOps"),
PartialOrd(trait = "conjure_object::private::DoubleOps"),
Ord(trait = "conjure_object::private::DoubleOps"),
Hash(trait = "conjure_object::private::DoubleOps"),
PartialEq(method(conjure_object::private::DoubleOps::eq)),
Ord(method(conjure_object::private::DoubleOps::cmp)),
Hash(method(conjure_object::private::DoubleOps::hash)),
)]
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion conjure-object/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "../README.md"
[dependencies]
base64 = "0.21"
chrono = { version = "0.4.26", default-features = false, features = ["clock", "std", "serde"] }
educe = { version = "0.4", default-features = false, features = [
educe = { version = "0.5", default-features = false, features = [
"Hash",
"PartialEq",
"Eq",
Expand Down
3 changes: 1 addition & 2 deletions conjure-object/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#![warn(clippy::all)]
#![warn(clippy::all, missing_docs)]

//! Rust implementations of Conjure types.
//!
//! This crate consists of reexports and definitions of the Rust types that correspond to Conjure types. It is a
//! required dependency of crates which contain Conjure-generated code.
#![warn(clippy::all, missing_docs)]

pub use chrono::{self, DateTime, Utc};
pub use serde;
Expand Down
34 changes: 0 additions & 34 deletions conjure-object/src/private.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ use std::marker::PhantomData;
use std::{fmt, mem};

pub trait DoubleOps {
fn partial_cmp(&self, other: &Self) -> Option<Ordering>;

fn cmp(&self, other: &Self) -> Ordering;

fn eq(&self, other: &Self) -> bool;
Expand All @@ -32,11 +30,6 @@ pub trait DoubleOps {
}

impl DoubleOps for f64 {
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
OrderedFloat(*self).partial_cmp(&OrderedFloat(*other))
}

#[inline]
fn cmp(&self, other: &Self) -> Ordering {
OrderedFloat(*self).cmp(&OrderedFloat(*other))
Expand All @@ -60,16 +53,6 @@ impl<T> DoubleOps for Option<T>
where
T: DoubleOps,
{
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
match (self, other) {
(Some(a), Some(b)) => a.partial_cmp(b),
(Some(_), None) => Some(Ordering::Greater),
(None, Some(_)) => Some(Ordering::Less),
(None, None) => Some(Ordering::Equal),
}
}

#[inline]
fn cmp(&self, other: &Self) -> Ordering {
match (self, other) {
Expand Down Expand Up @@ -105,23 +88,6 @@ impl<T> DoubleOps for Vec<T>
where
T: DoubleOps,
{
#[inline]
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
let l = usize::min(self.len(), other.len());

let lhs = &self[..l];
let rhs = &other[..l];

for i in 0..l {
match lhs[i].partial_cmp(&rhs[i]) {
Some(Ordering::Equal) => {}
v => return v,
}
}

self.len().partial_cmp(&other.len())
}

#[inline]
fn cmp(&self, other: &Self) -> Ordering {
let l = usize::min(self.len(), other.len());
Expand Down
7 changes: 3 additions & 4 deletions example-api/src/product/double_alias_example.rs

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

7 changes: 3 additions & 4 deletions example-api/src/product/double_example.rs

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

7 changes: 3 additions & 4 deletions example-api/src/product/list_example.rs

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

7 changes: 3 additions & 4 deletions example-api/src/product/many_field_example.rs

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

7 changes: 3 additions & 4 deletions example-api/src/product/primitive_optionals_example.rs

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

0 comments on commit 0806f62

Please sign in to comment.