]> git.lizzy.rs Git - rust.git/commitdiff
Return None when a literal exceeds budget
authortopecongiro <seuchida@gmail.com>
Wed, 15 Nov 2017 01:36:49 +0000 (10:36 +0900)
committertopecongiro <seuchida@gmail.com>
Wed, 15 Nov 2017 01:36:49 +0000 (10:36 +0900)
src/expr.rs

index 5aee87dbbb737725900af41ba96735ca323dde86..625f584c9b2a124202f73b8222c70324c02d4866 100644 (file)
@@ -1691,7 +1691,7 @@ fn rewrite_pat_expr(
 pub fn rewrite_literal(context: &RewriteContext, l: &ast::Lit, shape: Shape) -> Option<String> {
     match l.node {
         ast::LitKind::Str(_, ast::StrStyle::Cooked) => rewrite_string_lit(context, l.span, shape),
-        _ => Some(context.snippet(l.span)),
+        _ => wrap_str(context.snippet(l.span), context.config.max_width(), shape),
     }
 }