Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
iovxw committed Oct 27, 2017
1 parent babdaf1 commit 63aa9d5
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rssbot"
version = "1.3.0"
version = "1.3.2"
authors = ["iovxw <[email protected]>"]
license = "Unlicense"
readme = "README.md"
Expand Down
4 changes: 2 additions & 2 deletions src/cmdhandles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ fn register_sub(bot: &telebot::RcBot, db: Database, lphandle: Handle) {
})
})
.and_then(|(bot, db, subscriber, chat_id, feed)| {
match db.subscribe(subscriber, &feed.source.as_ref().unwrap(), &feed) {
match db.subscribe(subscriber, feed.source.as_ref().unwrap(), &feed) {
Ok(_) => {
bot.message(
chat_id,
Expand Down Expand Up @@ -471,6 +471,6 @@ fn check_channel<'a>(

await!(bot.delete_message(chat_id, msg_id).send())?;

return Ok(Some(channel_id));
Ok(Some(channel_id))
}
}
2 changes: 1 addition & 1 deletion src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ pub struct Database {

impl Clone for Database {
fn clone(&self) -> Database {
Database { inner: self.inner.clone() }
Database { inner: Rc::clone(&self.inner) }
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ fn make_request(
ua: String,
mut recur_limit: usize,
) -> Result<(Vec<u8>, String, u32)> {
let mut location = None;
let mut location: Option<String> = None;
loop {
if recur_limit == 0 {
break Err(ErrorKind::TooManyRedirects.into());
Expand All @@ -321,10 +321,10 @@ fn make_request(
let buf = Arc::new(Mutex::new(Vec::new()));
let location_buf = Arc::new(Mutex::new(String::new()));
{
let buf = buf.clone();
let location_buf = location_buf.clone();
let buf = Arc::clone(&buf);
let location_buf = Arc::clone(&location_buf);
req.get(true).unwrap();
req.url(&location.as_ref().unwrap_or(&source)).unwrap();
req.url(location.as_ref().unwrap_or(&source)).unwrap();
req.accept_encoding("").unwrap(); // accept all encoding
req.useragent(&ua).unwrap();
req.timeout(Duration::from_secs(10)).unwrap();
Expand Down
6 changes: 3 additions & 3 deletions src/fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ fn get_host(url: &str) -> &str {
}

#[async]
fn fetch_feed_updates<'a>(
fn fetch_feed_updates(
bot: telebot::RcBot,
db: data::Database,
session: Session,
Expand Down Expand Up @@ -131,8 +131,8 @@ fn fetch_feed_updates<'a>(
let feed::RSS {
title: rss_title,
link: rss_link,
source: _,
items: rss_items,
..
} = rss;
let updates = db.update(&feed.link, rss_items);
if updates.is_empty() {
Expand Down Expand Up @@ -168,7 +168,7 @@ fn fetch_feed_updates<'a>(
warn!("failed to send updates to {}, {:?}", subscriber, e);
}
}
if let &Some(ref rss) = &moved {
if let Some(ref rss) = moved {
// ignore error
let _ = db.unsubscribe(subscriber, &feed.link);
let _ = db.subscribe(subscriber, rss.source.as_ref().unwrap(), rss);
Expand Down
4 changes: 2 additions & 2 deletions src/utlis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ pub fn to_chinese_error_msg(e: errors::Error) -> String {
}

pub fn chat_is_unavailable(e: &telebot::error::Error) -> bool {
match e {
&telebot::error::Error::Telegram(_, ref s, _)
match *e {
telebot::error::Error::Telegram(_, ref s, _)
if s.contains("Forbidden") || s.contains("chat not found") ||
s.contains("group chat was migrated to a supergroup chat") => true,
_ => false,
Expand Down

0 comments on commit 63aa9d5

Please sign in to comment.