Skip to content

Commit ea0b3dc

Browse files
committed
Run cargo fmt
1 parent 2de01ea commit ea0b3dc

File tree

41 files changed

+171
-119
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+171
-119
lines changed

lib/grammers-client/examples/echo.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//! cargo run --example echo -- BOT_TOKEN
1111
//! ```
1212
13-
use futures_util::future::{select, Either};
13+
use futures_util::future::{Either, select};
1414
use grammers_client::session::Session;
1515
use grammers_client::{Client, Config, InitParams, Update};
1616
use simple_logger::SimpleLogger;

lib/grammers-client/examples/inline-pagination.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
//! how much data a button's payload can contain, and to keep it simple, we're storing it inline
2323
//! in decimal, so the numbers can't get too large).
2424
25-
use futures_util::future::{select, Either};
25+
use futures_util::future::{Either, select};
2626
use grammers_client::session::Session;
27-
use grammers_client::{button, reply_markup, Client, Config, InputMessage, Update};
27+
use grammers_client::{Client, Config, InputMessage, Update, button, reply_markup};
2828
use simple_logger::SimpleLogger;
2929
use std::env;
3030
use std::pin::pin;

lib/grammers-client/src/client/auth.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
8-
use super::net::connect_sender;
98
use super::Client;
9+
use super::net::connect_sender;
1010
use crate::types::{LoginToken, PasswordToken, TermsOfService, User};
1111
use crate::utils;
1212
use grammers_crypto::two_factor_auth::{calculate_2fa, check_p_and_g};

lib/grammers-client/src/client/bots.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
8+
use crate::Client;
89
use crate::client::messages::parse_mention_entities;
910
use crate::utils::generate_random_id;
10-
use crate::Client;
11-
use crate::{types::IterBuffer, InputMessage};
11+
use crate::{InputMessage, types::IterBuffer};
1212
pub use grammers_mtsender::{AuthorizationError, InvocationError};
1313
use grammers_session::PackedChat;
1414
use grammers_tl_types as tl;

lib/grammers-client/src/client/chats.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
1111
use super::Client;
1212
use crate::types::{
13-
chats::AdminRightsBuilderInner, chats::BannedRightsBuilderInner, AdminRightsBuilder,
14-
BannedRightsBuilder, Chat, ChatMap, IterBuffer, Message, Participant, Photo, User,
13+
AdminRightsBuilder, BannedRightsBuilder, Chat, ChatMap, IterBuffer, Message, Participant,
14+
Photo, User, chats::AdminRightsBuilderInner, chats::BannedRightsBuilderInner,
1515
};
1616
use grammers_mtsender::RpcError;
1717
pub use grammers_mtsender::{AuthorizationError, InvocationError};

lib/grammers-client/src/client/dialogs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
8-
use crate::types::{ChatMap, Dialog, IterBuffer, Message};
98
use crate::Client;
9+
use crate::types::{ChatMap, Dialog, IterBuffer, Message};
1010
use grammers_mtsender::InvocationError;
1111
use grammers_session::PackedChat;
1212
use grammers_tl_types as tl;

lib/grammers-client/src/client/files.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88

9+
use crate::Client;
910
use crate::types::{Downloadable, Uploaded};
1011
use crate::utils::generate_random_id;
11-
use crate::Client;
1212
use futures_util::stream::{FuturesUnordered, StreamExt as _};
1313
use grammers_mtsender::InvocationError;
1414
use grammers_tl_types as tl;
@@ -93,7 +93,7 @@ impl DownloadIter {
9393
return Ok(Some(data.clone()));
9494
}
9595
DownloadIterVariant::PreFailed(error) => {
96-
return Err(InvocationError::Read(error.into()))
96+
return Err(InvocationError::Read(error.into()));
9797
}
9898
DownloadIterVariant::Empty => return Ok(None),
9999
};

lib/grammers-client/src/client/messages.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
use crate::types::message::EMPTY_MESSAGE;
1111
use crate::types::{InputReactions, IterBuffer, Message};
1212
use crate::utils::{generate_random_id, generate_random_ids};
13-
use crate::{types, ChatMap, Client, InputMedia};
13+
use crate::{ChatMap, Client, InputMedia, types};
1414
use chrono::{DateTime, FixedOffset};
1515
pub use grammers_mtsender::{AuthorizationError, InvocationError};
1616
use grammers_session::PackedChat;
1717
use grammers_tl_types as tl;
18-
use log::{log_enabled, warn, Level};
18+
use log::{Level, log_enabled, warn};
1919
use std::collections::HashMap;
2020
use tl::enums::InputPeer;
2121

@@ -568,7 +568,9 @@ impl Client {
568568
Some(message) => message,
569569
None => {
570570
if let Some(updates) = updates_debug {
571-
warn!("failed to find just-sent message in response updates; please report this:");
571+
warn!(
572+
"failed to find just-sent message in response updates; please report this:"
573+
);
572574
warn!("{:#?}", updates);
573575
}
574576
Message::from_raw(self, EMPTY_MESSAGE.into(), &ChatMap::empty()).unwrap()

lib/grammers-client/src/client/net.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use grammers_mtproto::mtp;
1212
use grammers_mtproto::transport;
1313
use grammers_mtsender::ServerAddr;
1414
use grammers_mtsender::{
15-
self as sender, utils::sleep, AuthorizationError, InvocationError, RpcError, Sender,
15+
self as sender, AuthorizationError, InvocationError, RpcError, Sender, utils::sleep,
1616
};
1717
use grammers_session::{ChatHashCache, MessageBox};
1818
use grammers_tl_types::{self as tl, Deserializable};

lib/grammers-client/src/client/updates.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
1111
use super::Client;
1212
use crate::types::{ChatMap, Update};
13-
use futures_util::future::{select, Either};
13+
use futures_util::future::{Either, select};
1414
use grammers_mtsender::utils::sleep_until;
1515
pub use grammers_mtsender::{AuthorizationError, InvocationError};
1616
use grammers_session::channel_id;
@@ -120,7 +120,9 @@ impl Client {
120120
//
121121
// This is a bit hacky because MessageBox doesn't really have a way to "not update" the pts.
122122
// Instead we manually extract the previously-known pts and use that.
123-
log::warn!("Getting difference for channel updates caused PersistentTimestampOutdated; ending getting difference prematurely until server issues are resolved");
123+
log::warn!(
124+
"Getting difference for channel updates caused PersistentTimestampOutdated; ending getting difference prematurely until server issues are resolved"
125+
);
124126
{
125127
self.0
126128
.state

lib/grammers-client/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub(crate) mod utils;
5353
compile_error!("The `fs` feature is not supported on wasm32-unknown-unknown.");
5454

5555
pub use client::{Client, Config, InitParams, SignInError};
56-
pub use types::{button, reply_markup, ChatMap, InputMedia, InputMessage, Update};
56+
pub use types::{ChatMap, InputMedia, InputMessage, Update, button, reply_markup};
5757

5858
pub use grammers_mtproto::transport;
5959
pub use grammers_mtsender::{FixedReconnect, InvocationError, NoReconnect, ReconnectionPolicy};

lib/grammers-client/src/parsers/html.rs

+37-27
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use std::cell::Cell;
1111

1212
use super::common::{
13-
after, before, inject_into_message, telegram_string_len, Segment, MENTION_URL_PREFIX,
13+
MENTION_URL_PREFIX, Segment, after, before, inject_into_message, telegram_string_len,
1414
};
1515
use crate::update_entity_len;
1616
use grammers_tl_types as tl;
@@ -351,11 +351,13 @@ mod tests {
351351
assert_eq!(text, "Hello world!");
352352
assert_eq!(
353353
entities,
354-
vec![tl::types::MessageEntityBold {
355-
offset: 0,
356-
length: 5
357-
}
358-
.into()]
354+
vec![
355+
tl::types::MessageEntityBold {
356+
offset: 0,
357+
length: 5
358+
}
359+
.into()
360+
]
359361
);
360362
}
361363

@@ -365,11 +367,13 @@ mod tests {
365367
assert_eq!(text, "Hello world!");
366368
assert_eq!(
367369
entities,
368-
vec![tl::types::MessageEntityBold {
369-
offset: 6,
370-
length: 6
371-
}
372-
.into()]
370+
vec![
371+
tl::types::MessageEntityBold {
372+
offset: 6,
373+
length: 6
374+
}
375+
.into()
376+
]
373377
);
374378
}
375379

@@ -379,11 +383,13 @@ mod tests {
379383
assert_eq!(text, "A little 🦀 here");
380384
assert_eq!(
381385
entities,
382-
vec![tl::types::MessageEntityBold {
383-
offset: 2,
384-
length: 9
385-
}
386-
.into()]
386+
vec![
387+
tl::types::MessageEntityBold {
388+
offset: 2,
389+
length: 9
390+
}
391+
.into()
392+
]
387393
);
388394
}
389395

@@ -501,11 +507,13 @@ mod tests {
501507
assert_eq!(text, "Some empty and code");
502508
assert_eq!(
503509
entities,
504-
vec![tl::types::MessageEntityCode {
505-
offset: 16,
506-
length: 4,
507-
}
508-
.into(),]
510+
vec![
511+
tl::types::MessageEntityCode {
512+
offset: 16,
513+
length: 4,
514+
}
515+
.into(),
516+
]
509517
);
510518
}
511519

@@ -516,12 +524,14 @@ mod tests {
516524
assert_eq!(text, "Some empty link, it does nothing");
517525
assert_eq!(
518526
entities,
519-
vec![tl::types::MessageEntityTextUrl {
520-
offset: 5,
521-
length: 10,
522-
url: "".to_string()
523-
}
524-
.into(),]
527+
vec![
528+
tl::types::MessageEntityTextUrl {
529+
offset: 5,
530+
length: 10,
531+
url: "".to_string()
532+
}
533+
.into(),
534+
]
525535
);
526536
}
527537

lib/grammers-client/src/parsers/markdown.rs

+22-16
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#![cfg(feature = "markdown")]
99

1010
use super::common::{
11-
after, before, inject_into_message, telegram_string_len, Segment, MENTION_URL_PREFIX,
11+
MENTION_URL_PREFIX, Segment, after, before, inject_into_message, telegram_string_len,
1212
};
1313
use crate::update_entity_len;
1414
use grammers_tl_types as tl;
@@ -225,11 +225,13 @@ mod tests {
225225
assert_eq!(text, "Hello world!");
226226
assert_eq!(
227227
entities,
228-
vec![tl::types::MessageEntityBold {
229-
offset: 0,
230-
length: 5
231-
}
232-
.into()]
228+
vec![
229+
tl::types::MessageEntityBold {
230+
offset: 0,
231+
length: 5
232+
}
233+
.into()
234+
]
233235
);
234236
}
235237

@@ -239,11 +241,13 @@ mod tests {
239241
assert_eq!(text, "Hello world!");
240242
assert_eq!(
241243
entities,
242-
vec![tl::types::MessageEntityBold {
243-
offset: 6,
244-
length: 6
245-
}
246-
.into()]
244+
vec![
245+
tl::types::MessageEntityBold {
246+
offset: 6,
247+
length: 6
248+
}
249+
.into()
250+
]
247251
);
248252
}
249253

@@ -253,11 +257,13 @@ mod tests {
253257
assert_eq!(text, "A little 🦀 here");
254258
assert_eq!(
255259
entities,
256-
vec![tl::types::MessageEntityBold {
257-
offset: 2,
258-
length: 9
259-
}
260-
.into()]
260+
vec![
261+
tl::types::MessageEntityBold {
262+
offset: 2,
263+
length: 9
264+
}
265+
.into()
266+
]
261267
);
262268
}
263269

lib/grammers-client/src/types/action.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
88
use futures_util::future::Either;
9-
use grammers_mtsender::utils;
109
use grammers_mtsender::InvocationError;
10+
use grammers_mtsender::utils;
1111
use grammers_session::PackedChat;
1212
use grammers_tl_types as tl;
1313
use std::future::Future;

lib/grammers-client/src/types/callback_query.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
8-
use crate::{types, Client, InputMessage};
8+
use crate::{Client, InputMessage, types};
99
use grammers_mtsender::InvocationError;
1010
use grammers_tl_types as tl;
1111
use std::convert::TryInto;

lib/grammers-client/src/types/chats.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
8-
use crate::types::Role;
98
use crate::Client;
9+
use crate::types::Role;
1010
use grammers_mtsender::{InvocationError, RpcError};
1111
use grammers_session::PackedChat;
1212
use grammers_tl_types as tl;
@@ -181,7 +181,7 @@ impl<F: Future<Output = BuilderRes>> AdminRightsBuilder<F> {
181181
name: "PEER_ID_INVALID".to_string(),
182182
value: None,
183183
caused_by: None,
184-
}))
184+
}));
185185
}
186186
};
187187

lib/grammers-client/src/types/inline/query.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// except according to those terms.
88

99
use super::super::{Chat, ChatMap, User};
10-
use crate::{client::Client, utils::generate_random_id, InputMessage};
10+
use crate::{InputMessage, client::Client, utils::generate_random_id};
1111
use grammers_mtsender::InvocationError;
1212
use grammers_tl_types as tl;
1313
use std::fmt;

lib/grammers-client/src/types/message.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
66
// option. This file may not be copied, modified, or distributed
77
// except according to those terms.
8+
use crate::ChatMap;
89
#[cfg(any(feature = "markdown", feature = "html"))]
910
use crate::parsers;
1011
use crate::types::reactions::InputReactions;
1112
use crate::types::{InputMessage, Media, Photo};
12-
use crate::ChatMap;
13-
use crate::{types, Client};
14-
use crate::{utils, InputMedia};
13+
use crate::{Client, types};
14+
use crate::{InputMedia, utils};
1515
use chrono::{DateTime, Utc};
1616
use grammers_mtsender::InvocationError;
1717
use grammers_session::PackedChat;

lib/grammers-client/src/types/update.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use std::sync::Arc;
1010

1111
use super::{CallbackQuery, ChatMap, InlineQuery, InlineSend, Message};
12-
use crate::{types::MessageDeletion, Client};
12+
use crate::{Client, types::MessageDeletion};
1313
use grammers_tl_types as tl;
1414

1515
#[non_exhaustive]

0 commit comments

Comments
 (0)