From 461aa38a7abbae783ed130db27b71c026df971f7 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 2 Dec 2017 21:40:41 -0800 Subject: track dirty bit to know if we should redraw display also clean up a bunch of TODOs --- src/commands/fav.rs | 4 ++-- src/commands/profile.rs | 3 --- src/commands/twete.rs | 4 ++-- 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src/commands') diff --git a/src/commands/fav.rs b/src/commands/fav.rs index 5e5f2a2..02ec7dd 100644 --- a/src/commands/fav.rs +++ b/src/commands/fav.rs @@ -21,7 +21,7 @@ fn unfav(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer, di let maybe_id = TweetId::parse(line.to_owned()); match maybe_id { Ok(twid) => { - if let Some(twete) = tweeter.retrieve_tweet(&twid).map(|x| x.clone()) { // TODO: no clone when this stops taking &mut self + if let Some(twete) = tweeter.retrieve_tweet(&twid) { let result = match tweeter.current_profile() { Some(user_profile) => queryer.do_api_post(&format!("{}?id={}", UNFAV_TWEET_URL, twete.id), &tweeter.app_key, &user_profile.creds), None => Err("No logged in user to unfav from".to_owned()) @@ -53,7 +53,7 @@ fn fav(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer, disp match maybe_id { Ok(twid) => { // tweeter.to_twitter_tweet_id(twid)... - if let Some(twete) = tweeter.retrieve_tweet(&twid).map(|x| x.clone()) { // TODO: no clone when this stops taking &mut self + if let Some(twete) = tweeter.retrieve_tweet(&twid) { let result = match tweeter.current_profile() { Some(user_profile) => queryer.do_api_post(&format!("{}?id={}", FAV_TWEET_URL, twete.id), &tweeter.app_key, &user_profile.creds), None => Err("No logged in user to fav from".to_owned()) diff --git a/src/commands/profile.rs b/src/commands/profile.rs index e20859b..f3bfd8d 100644 --- a/src/commands/profile.rs +++ b/src/commands/profile.rs @@ -1,8 +1,5 @@ use display::DisplayInfo; use tw; -use std; -use std::collections::HashMap; -use hyper; use ::Queryer; use commands::Command; diff --git a/src/commands/twete.rs b/src/commands/twete.rs index ebf3c3d..d727b9e 100644 --- a/src/commands/twete.rs +++ b/src/commands/twete.rs @@ -54,7 +54,7 @@ fn twete(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer, di // if it's just "t", enter compose mode. let text = line.trim().to_owned(); if text.len() == 0 { - display_info.mode = Some(::display::DisplayMode::Compose(text)); + display_info.set_mode(Some(::display::DisplayMode::Compose(text))); } else { send_twete(text, tweeter, queryer, display_info); } @@ -178,7 +178,7 @@ fn rep(line: String, tweeter: &mut tw::TwitterCache, queryer: &mut Queryer, disp if reply.len() > 0 { send_reply(full_reply, twid, tweeter, queryer, user_profile.creds, display_info); } else { - display_info.mode = Some(::display::DisplayMode::Reply(twid, full_reply)); + display_info.set_mode(Some(::display::DisplayMode::Reply(twid, full_reply))); } } else { display_info.status(format!("No tweet for id: {:?}", twid)); -- cgit v1.1