Skip to content

Commit

Permalink
refactor: specify Eq when possible on PartialEq (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo authored Jun 16, 2022
1 parent 3aff024 commit 237a1e3
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 161 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ For api parameters, the same approach is used. The only difference for parameter
For example, parameters for `leaveChat` method:

```rust
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct LeaveChatParams {
chat_id: ChatId,
}
Expand Down
3 changes: 1 addition & 2 deletions examples/api_trait_implementation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::path::PathBuf;
static TOKEN: &str = "TOKEN";
static BASE_API_URL: &str = "https://api.telegram.org/bot";

#[derive(PartialEq, Debug)]
pub struct Api {
pub api_url: String,
}
Expand All @@ -18,7 +17,7 @@ pub enum Error {
ApiError(ErrorResponse),
}

#[derive(PartialEq, Debug)]
#[derive(Debug)]
pub struct HttpError {
pub code: u16,
pub message: String,
Expand Down
4 changes: 2 additions & 2 deletions src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ pub use telegram_api_impl::*;

pub static BASE_API_URL: &str = "https://api.telegram.org/bot";

#[derive(PartialEq, Debug, Serialize, Deserialize, thiserror::Error)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, thiserror::Error)]
#[serde(untagged)]
pub enum Error {
#[error("{0}")]
Expand All @@ -26,7 +26,7 @@ pub enum Error {
EncodeError(String),
}

#[derive(PartialEq, Debug, Serialize, Deserialize, thiserror::Error)]
#[derive(Debug, Serialize, Deserialize, PartialEq, Eq, thiserror::Error)]
#[error("Http Error {code}: {message}")]
pub struct HttpError {
pub code: u16,
Expand Down
Loading

0 comments on commit 237a1e3

Please sign in to comment.