Skip to content

Commit

Permalink
refactor: fix some lints (#151)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo authored Mar 26, 2024
1 parent 26764af commit 795862b
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
3 changes: 1 addition & 2 deletions examples/async_custom_client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use frankenstein::reqwest;
use frankenstein::AsyncApi;
use frankenstein::AsyncTelegramApi;
use std::time::Duration;
Expand Down Expand Up @@ -26,7 +25,7 @@ async fn main() {
}

fn custom_client() -> AsyncApi {
let client = reqwest::ClientBuilder::new()
let client = frankenstein::reqwest::ClientBuilder::new()
.connect_timeout(Duration::from_secs(100))
.timeout(Duration::from_secs(100))
.build()
Expand Down
5 changes: 3 additions & 2 deletions examples/custom_client.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use frankenstein::ureq;
use frankenstein::Api;
use frankenstein::TelegramApi;
use std::time::Duration;
Expand All @@ -25,7 +24,9 @@ fn main() {
}

fn custom_client() -> Api {
let request_agent = ureq::builder().timeout(Duration::from_secs(100)).build();
let request_agent = frankenstein::ureq::builder()
.timeout(Duration::from_secs(100))
.build();
let api_url = format!("{BASE_API_URL}{TOKEN}");

Api::builder()
Expand Down
2 changes: 1 addition & 1 deletion src/api/telegram_api_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ impl Api {

/// Create a new `Api`. You can use `Api::builder()` for more options.
pub fn new_url<T: Into<String>>(api_url: T) -> Self {
Api::builder().api_url(api_url).build()
Self::builder().api_url(api_url).build()
}

pub fn encode_params<T: serde::ser::Serialize + std::fmt::Debug>(
Expand Down
10 changes: 5 additions & 5 deletions src/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1069,13 +1069,13 @@ pub enum MessageOrigin {
Channel(MessageOriginChannel),
}

#[derive(Builder, Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Builder, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct MessageOriginUser {
pub date: u64,
pub sender_user: User,
}

#[derive(Builder, Clone, Debug, Serialize, Deserialize, PartialEq)]
#[derive(Builder, Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
pub struct MessageOriginHiddenUser {
pub date: u64,
#[builder(setter(into))]
Expand Down Expand Up @@ -1990,7 +1990,7 @@ pub struct ReactionTypeCustomEmoji {
pub custom_emoji_id: String,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct ReactionCount {
#[builder(setter(into))]
#[serde(rename = "type")]
Expand Down Expand Up @@ -3510,7 +3510,7 @@ pub struct GameHighScore {
pub score: i32,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct GiveawayCreated {}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)]
Expand Down Expand Up @@ -3722,7 +3722,7 @@ pub struct ChatBoostRemoved {
pub source: ChatBoostSource,
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Builder)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Builder)]
pub struct UserChatBoosts {
pub boosts: Vec<ChatBoost>,
}
Expand Down
12 changes: 6 additions & 6 deletions src/parse_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ impl FromStr for ParseMode {
type Err = ();
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"HTML" | "Html" | "html" => Ok(ParseMode::Html),
"Markdown" | "markdown" => Ok(ParseMode::Markdown),
"MarkdownV2" | "markdownv2" => Ok(ParseMode::MarkdownV2),
"HTML" | "Html" | "html" => Ok(Self::Html),
"Markdown" | "markdown" => Ok(Self::Markdown),
"MarkdownV2" | "markdownv2" => Ok(Self::MarkdownV2),
_ => Err(()),
}
}
Expand All @@ -31,9 +31,9 @@ impl FromStr for ParseMode {
impl ParseMode {
pub const fn to_str(self) -> &'static str {
match self {
ParseMode::Html => "HTML",
ParseMode::MarkdownV2 => "MarkdownV2",
ParseMode::Markdown => "Markdown",
Self::Html => "HTML",
Self::MarkdownV2 => "MarkdownV2",
Self::Markdown => "Markdown",
}
}
}
Expand Down

0 comments on commit 795862b

Please sign in to comment.