diff --git a/Cargo.toml b/Cargo.toml index f3a7b7b44..c8e8e4d01 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,11 +19,12 @@ exclude = ["openapi"] [workspace.package] version = "0.22.2" description = "API bindings for the Stripe HTTP API" -rust-version = "1.67.0" +rust-version = "1.68.0" authors = [ "Anna Baldwin ", "Kevin Stenerson ", "Alexander Lyon ", + "Matthew Zeitlin " ] license = "MIT OR Apache-2.0" readme = "README.md" diff --git a/async-stripe/src/lib.rs b/async-stripe/src/lib.rs index 60c9915f0..c6b803fd1 100644 --- a/async-stripe/src/lib.rs +++ b/async-stripe/src/lib.rs @@ -7,7 +7,6 @@ // except according to those terms. #![doc(html_root_url = "https://docs.rs/async-stripe/")] -#![recursion_limit = "128"] //! This crate provides Rust bindings to the Stripe HTTP API. //! diff --git a/examples/strategy.rs b/examples/strategy.rs deleted file mode 100644 index a928ab7b4..000000000 --- a/examples/strategy.rs +++ /dev/null @@ -1,26 +0,0 @@ -//! Payment Link -//! ============ -//! -//! Reference: -//! -//! This example shows how to create a payment link for -//! a particular product and price. The nice thing with -//! this API is the lack of associated customer. - -use stripe::{Client, Customer, ListCustomers, RequestStrategy}; - -#[tokio::main] -async fn main() { - let secret_key = std::env::var("STRIPE_SECRET_KEY").expect("Missing STRIPE_SECRET_KEY in env"); - let client = Client::new(secret_key).with_strategy(RequestStrategy::idempotent_with_uuid()); - - let first_page = - Customer::list(&client, &ListCustomers { limit: Some(1), ..Default::default() }) - .await - .unwrap(); - - println!( - "first page of customers: {:#?}", - first_page.data.iter().map(|c| c.name.as_ref().unwrap()).collect::>() - ); -} diff --git a/openapi/src/stripe_object.rs b/openapi/src/stripe_object.rs index cece343e9..1483527c9 100644 --- a/openapi/src/stripe_object.rs +++ b/openapi/src/stripe_object.rs @@ -2,6 +2,7 @@ use std::collections::HashMap; use heck::ToSnakeCase; use indexmap::IndexMap; +use lazy_static::lazy_static; use openapiv3::Schema; use serde::{Deserialize, Serialize}; @@ -255,17 +256,16 @@ impl StripeResource { } } -fn object_renames() -> HashMap<&'static str, &'static str> { - return HashMap::from([ - ("invoiceitem", "invoice_item"), - ("item", "checkout_session_item"), - ("line_item", "invoice_line_item"), - ("fee_refund", "application_fee_refund"), - ]); -} - fn infer_object_ident(path: &ComponentPath) -> RustIdent { - if let Some(renamed) = object_renames().get(path.as_ref()) { + lazy_static! { + static ref OBJECT_RENAMES: HashMap<&'static str, &'static str> = HashMap::from([ + ("invoiceitem", "invoice_item"), + ("item", "checkout_session_item"), + ("line_item", "invoice_line_item"), + ("fee_refund", "application_fee_refund"), + ]); + } + if let Some(renamed) = OBJECT_RENAMES.get(path.as_ref()) { RustIdent::create(renamed) } else { RustIdent::create(path) diff --git a/stripe_types/src/lib.rs b/stripe_types/src/lib.rs index bbd3119a5..ecb2261f5 100644 --- a/stripe_types/src/lib.rs +++ b/stripe_types/src/lib.rs @@ -1,4 +1,3 @@ -#![recursion_limit = "128"] // FIXME: could be worked around in the codegen #![allow(clippy::large_enum_variant)] // FIXME: probably fixable with better doc comment formatting, but stripe might also just have doc typos at times that break the regex diff --git a/tests/tests/it/mock/mod.rs b/tests/tests/it/mock.rs similarity index 100% rename from tests/tests/it/mock/mod.rs rename to tests/tests/it/mock.rs