Skip to content

Commit

Permalink
Merge pull request #582 from augustoccesar/fix/linting-issues-from-1.80
Browse files Browse the repository at this point in the history
fix(next): linting issues from Rust 1.80
  • Loading branch information
arlyon authored Jul 31, 2024
2 parents 54553bf + 1b938a9 commit 48d4653
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 11 deletions.
27 changes: 24 additions & 3 deletions async-stripe-webhook/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,34 @@ chrono = { version = "0.4", default-features = false, features = ["clock"] }
thiserror = "1.0.24"
miniserde.workspace = true
serde.workspace = true
serde_json = { workspace = true, optional = true }

async-stripe-core = { path = "../generated/async-stripe-core", optional = true }
async-stripe-checkout = { path = "../generated/async-stripe-checkout", optional = true }
async-stripe-billing = { path = "../generated/async-stripe-billing", optional = true }
async-stripe-checkout = { path = "../generated/async-stripe-checkout", optional = true }
async-stripe-core = { path = "../generated/async-stripe-core", optional = true }
async-stripe-fraud = { path = "../generated/async-stripe-fraud", optional = true }
async-stripe-misc = { path = "../generated/async-stripe-misc", optional = true }
async-stripe-payment = { path = "../generated/async-stripe-payment", optional = true }
async-stripe-terminal = { path = "../generated/async-stripe-terminal", optional = true }
async-stripe-treasury = { path = "../generated/async-stripe-treasury", optional = true }

[dev-dependencies]
serde_json.workspace = true

[features]
serialize = ["async-stripe-types/serialize", "async-stripe-shared/serialize"]
deserialize = ["async-stripe-types/deserialize", "async-stripe-shared/deserialize", "dep:serde_json"]

full = [
"async-stripe-billing",
"async-stripe-checkout",
"async-stripe-core",
"async-stripe-fraud",
"async-stripe-misc",
"async-stripe-payment",
"async-stripe-terminal",
"async-stripe-treasury",
]

[package.metadata.docs.rs]
features = ["async-stripe-core", "async-stripe-checkout", "async-stripe-billing"]
features = ["full"]
2 changes: 1 addition & 1 deletion async-stripe-webhook/src/webhook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ mod tests {
assert_eq!(invoice.quantity, 3);
}

#[cfg(feature = "stripe_billing")]
#[cfg(feature = "async-stripe-billing")]
#[test]
// https://github.com/arlyon/async-stripe/issues/455
fn test_billing_portal_session() {
Expand Down
8 changes: 4 additions & 4 deletions async-stripe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
//! to determine which fields are required for either request.
//!
//! > **Note:** We have an extensive collection of examples which are interspersed in
//! the documentation. Any time an API is used in an example it is highlighted in the
//! docs for that item. You can also find all the raw examples in the `examples` directory.
//! Please have a look at those for inspiration or ideas on how to get started.
//! > the documentation. Any time an API is used in an example it is highlighted in the
//! > docs for that item. You can also find all the raw examples in the `examples` directory.
//! > Please have a look at those for inspiration or ideas on how to get started.
//!
//! ## Idempotency / Request Strategies
//!
Expand All @@ -51,7 +51,7 @@
//! generated automatically and is stable across retries.
//!
//! > Want to implement your own? If it is a common strategy, please consider opening a PR to add it to the library.
//! Otherwise, we are open to turning this into an open trait so that you can implement your own strategy.
//! > Otherwise, we are open to turning this into an open trait so that you can implement your own strategy.

#![warn(clippy::missing_errors_doc, clippy::missing_panics_doc)]
#![deny(missing_docs, missing_debug_implementations)]
Expand Down
4 changes: 2 additions & 2 deletions generated/async-stripe-shared/src/invoice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub struct Invoice {
///
/// * `manual`: Unrelated to a subscription, for example, created via the invoice editor.
/// * `subscription`: No longer in use.
/// Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds.
/// Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds.
/// * `subscription_create`: A new subscription was created.
/// * `subscription_cycle`: A subscription advanced into a new period.
/// * `subscription_threshold`: A subscription reached a billing threshold.
Expand Down Expand Up @@ -893,7 +893,7 @@ impl serde::Serialize for Invoice {
///
/// * `manual`: Unrelated to a subscription, for example, created via the invoice editor.
/// * `subscription`: No longer in use.
/// Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds.
/// Applies to subscriptions from before May 2018 where no distinction was made between updates, cycles, and thresholds.
/// * `subscription_create`: A new subscription was created.
/// * `subscription_cycle`: A subscription advanced into a new period.
/// * `subscription_threshold`: A subscription reached a billing threshold.
Expand Down
10 changes: 9 additions & 1 deletion openapi/src/templates/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,20 @@ pub fn write_doc_comment(description: &str, depth: u8) -> String {
out.push_str(line);
// If an unreasonable line, inject newlines after each sentence
} else {
let is_list_item = line.starts_with("* ");

for (i, part) in PERIOD_THEN_WHITESPACE.split(line).enumerate() {
if i > 0 {
out.push('\n');
}
print_indent(&mut out, depth);
out.push_str("/// ");

if is_list_item && i > 0 {
out.push_str("/// ");
} else {
out.push_str("/// ");
}

out.push_str(part.trim());
if !part.is_empty() && !out.ends_with('.') {
out.push('.');
Expand Down

0 comments on commit 48d4653

Please sign in to comment.