Skip to content

Commit

Permalink
Remove default derive for id
Browse files Browse the repository at this point in the history
  • Loading branch information
mzeitlin11 committed Mar 20, 2024
1 parent e7b7da3 commit 00aa897
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ they stay up to date, preventing errors error deserialization errors like (https
does not include the status code.
- The `id` method on `Expandable<T>` now returns a reference: `&T::Id`. All id types implement `Clone` so
to achieve the previous behavior, use `.id().clone()`.
- `*Id` types no longer derive `default`. The previous default was an empty string, which will never be a valid id
- Removed the `AsRef<str>` implementation for enums, use `as_str` instead.

Since most of these changes are related to code generation, it is likely there are some
Expand Down
6 changes: 0 additions & 6 deletions openapi/src/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ fn deduplicate_method_names<'a>(
let has_dup_name =
base_names.iter().any(|(&key, name)| key != req_key && name == curr_name);
if has_dup_name {
if req.path_params.is_empty() {
dbg!(req);
dbg!(curr_name);
dbg!(req_key);
dbg!(base_names);
}
let path_param =
req.path_params.first().expect("Expected path parameter on duplicate method");
dedupped.insert(req_key, format!("{curr_name}_{}", path_param.name));
Expand Down
4 changes: 2 additions & 2 deletions stripe_types/src/ids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ macro_rules! def_id_serde_impls {
#[macro_export]
macro_rules! def_id {
($struct_name:ident) => {
#[derive(Clone, Debug, Default, Eq, PartialEq, Hash)]
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct $struct_name(smol_str::SmolStr);

impl $struct_name {
Expand Down Expand Up @@ -115,7 +115,7 @@ macro_rules! def_id {
///
/// This type _typically_ will not allocate and
/// therefore is usually cheaply clonable.
#[derive(Clone, Debug, Default, Eq, PartialEq, Hash)]
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
pub struct $struct_name(smol_str::SmolStr);

impl $struct_name {
Expand Down

0 comments on commit 00aa897

Please sign in to comment.