From e47646b44b6598dc8578bf9ede76893dbcc07ea9 Mon Sep 17 00:00:00 2001 From: Sinh Pham Date: Wed, 9 Sep 2015 07:56:56 -0400 Subject: [PATCH] Small style fixes. --- Cargo.toml | 1 - src/expr.rs | 2 +- src/string.rs | 9 ++++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 377c88a955b..597eb8f942d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,5 +20,4 @@ regex = "0.1.41" [dev-dependencies] diff = "0.1.0" -regex = "0.1" term = "0.2" diff --git a/src/expr.rs b/src/expr.rs index ab20dc1738d..e641d7c6762 100644 --- a/src/expr.rs +++ b/src/expr.rs @@ -846,7 +846,7 @@ fn rewrite_string_lit(context: &RewriteContext, width: usize, offset: usize) -> Option { - if context.config.format_strings == false { + if !context.config.format_strings { return Some(context.snippet(span)); } diff --git a/src/string.rs b/src/string.rs index ba93b2db81d..aba6a7f48da 100644 --- a/src/string.rs +++ b/src/string.rs @@ -10,8 +10,6 @@ // Format string literals. - - use unicode_segmentation::UnicodeSegmentation; use regex::Regex; @@ -74,10 +72,11 @@ pub fn rewrite_string<'a>(s: &str, fmt: &StringFormat<'a>) -> String { cur_end += 1; } let raw_line = graphemes[cur_start..cur_end].join(""); - let line: &str = if fmt.trim_end { - &(raw_line.trim()) + let line = if fmt.trim_end { + raw_line.trim() } else { - &raw_line + // TODO: use as_str once it's stable. + &*raw_line }; result.push_str(line);