Skip to content

Commit

Permalink
fix: Clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
jwiesler committed Apr 26, 2024
1 parent 3a8e65e commit 842bce6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 22 deletions.
6 changes: 6 additions & 0 deletions src/client/base/tokio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ pub struct TokioClient {
client: HttpClient,
}

impl Default for TokioClient {
fn default() -> Self {
Self::new()
}
}

impl TokioClient {
pub fn new() -> Self {
Self {
Expand Down
9 changes: 2 additions & 7 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ impl From<http_types::Error> for StripeError {
}

/// The list of possible values for a RequestError's type.
#[derive(Debug, PartialEq, Deserialize)]
#[derive(Debug, PartialEq, Deserialize, Default)]
pub enum ErrorType {
#[serde(skip_deserializing)]
#[default]
Unknown,
#[serde(rename = "api_error")]
Api,
Expand All @@ -58,12 +59,6 @@ pub enum ErrorType {
Validation,
}

impl Default for ErrorType {
fn default() -> Self {
ErrorType::Unknown
}
}

impl std::fmt::Display for ErrorType {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", to_snakecase(&format!("{:?}Error", self)))
Expand Down
8 changes: 2 additions & 6 deletions src/resources/balance_transaction_ext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ impl std::default::Default for BalanceTransactionStatus {
/// An enum representing the possible values of an `Fee`'s `type` field.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq)]
#[serde(rename_all = "snake_case")]
#[derive(Default)]
pub enum FeeType {
#[default]
ApplicationFee,
StripeFee,
Tax,
Expand All @@ -151,9 +153,3 @@ impl std::fmt::Display for FeeType {
self.as_str().fmt(f)
}
}

impl std::default::Default for FeeType {
fn default() -> Self {
FeeType::ApplicationFee
}
}
9 changes: 2 additions & 7 deletions src/resources/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::params::to_snakecase;
/// Currency is the list of supported currencies.
///
/// For more details see <https://support.stripe.com/questions/which-currencies-does-stripe-support>.
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq, Hash)]
#[derive(Copy, Clone, Debug, Deserialize, Serialize, Eq, PartialEq, Hash, Default)]
pub enum Currency {
#[serde(rename = "byn")]
BYN, // Belarusian Ruble
Expand Down Expand Up @@ -262,6 +262,7 @@ pub enum Currency {
#[serde(rename = "ugx")]
UGX, // Ugandan Shilling
#[serde(rename = "usd")]
#[default]
USD, // United States Dollar
#[serde(rename = "uyu")]
UYU, // Uruguayan Peso
Expand Down Expand Up @@ -291,12 +292,6 @@ pub enum Currency {
ZMW, // Zambian Kwacha
}

impl Default for Currency {
fn default() -> Self {
Currency::USD
}
}

impl std::fmt::Display for Currency {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", to_snakecase(&format!("{:?}", self)))
Expand Down
4 changes: 2 additions & 2 deletions tests/mock/mod.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
//! Setup and teardown for the stripe mock service.

#[allow(dead_code)]
pub fn with_client<T>(test: T) -> ()
pub fn with_client<T>(test: T)
where
T: FnOnce(&stripe::Client) -> () + std::panic::UnwindSafe,
T: FnOnce(&stripe::Client) + std::panic::UnwindSafe,
{
let result = std::panic::catch_unwind(|| {
let client = stripe::Client::from_url("http://localhost:12111", "sk_test_123");
Expand Down

0 comments on commit 842bce6

Please sign in to comment.