From 2eeb3663116df5dbf2ed7291277d79c5ff201b89 Mon Sep 17 00:00:00 2001 From: Seiichi Uchida Date: Sun, 5 Aug 2018 10:50:34 +0900 Subject: Ignore comment in wrap_str --- src/utils.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/utils.rs') diff --git a/src/utils.rs b/src/utils.rs index 5f92255e79c..9eac3fd4f0d 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -18,6 +18,7 @@ use syntax::ast::{ use syntax::codemap::{BytePos, Span, NO_EXPANSION}; use syntax::ptr; +use comment::filter_normal_code; use rewrite::RewriteContext; use shape::Shape; @@ -350,7 +351,7 @@ macro_rules! skip_out_of_file_lines_range_visitor { // Wraps String in an Option. Returns Some when the string adheres to the // Rewrite constraints defined for the Rewrite trait and None otherwise. pub fn wrap_str(s: String, max_width: usize, shape: Shape) -> Option { - if is_valid_str(&s, max_width, shape) { + if is_valid_str(&filter_normal_code(&s), max_width, shape) { Some(s) } else { None -- cgit 1.4.1-3-g733a5