From e6091834b942f0c08c87a27223721c45795da627 Mon Sep 17 00:00:00 2001 From: iximeow Date: Sat, 11 Nov 2017 03:33:40 -0800 Subject: move id formatting into a Display impl --- src/display/mod.rs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/display') diff --git a/src/display/mod.rs b/src/display/mod.rs index 92fa9dd..0eeba68 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -363,12 +363,13 @@ pub fn render_twete(twete_id: &TweetId, tweeter: &mut tw::TwitterCache) -> Vec Vec { - result.push(format!("{} id:{}{}{}", + result.push(format!("{} id {}{}{}", id_color, twete.internal_id, twete.reply_to_tweet.clone() - .map(|id| tweeter.retrieve_tweet(&TweetId::Twitter(id.to_owned())) - .and_then(|tw| Some(format!(" reply_to:{}", tw.internal_id))) - .unwrap_or(format!(" reply_to:twitter::{}", id)) + .map(|id_str| TweetId::Twitter(id_str.to_owned())) + .map(|id| tweeter.retrieve_tweet(&id) + .and_then(|tw| Some(format!(" reply to {}", tw.internal_id))) + .unwrap_or(format!(" reply to {}", id)) ) .unwrap_or("".to_string()), color::Fg(color::Reset) @@ -406,12 +408,13 @@ pub fn render_twete(twete_id: &TweetId, tweeter: &mut tw::TwitterCache) -> Vec