mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-05 05:04:24 +00:00
Return None when string literal from source exceeds max width
This commit is contained in:
parent
1664ebb18b
commit
033ce59a6a
@ -1929,7 +1929,7 @@ fn rewrite_string_lit(context: &RewriteContext, span: Span, shape: Shape) -> Opt
|
||||
.all(|line| line.ends_with('\\'))
|
||||
{
|
||||
let new_indent = shape.visual_indent(1).indent;
|
||||
return Some(String::from(
|
||||
let indented_string_lit = String::from(
|
||||
string_lit
|
||||
.lines()
|
||||
.map(|line| {
|
||||
@ -1942,16 +1942,17 @@ fn rewrite_string_lit(context: &RewriteContext, span: Span, shape: Shape) -> Opt
|
||||
.collect::<Vec<_>>()
|
||||
.join("\n")
|
||||
.trim_left(),
|
||||
));
|
||||
);
|
||||
return wrap_str(indented_string_lit, context.config.max_width(), shape);
|
||||
} else {
|
||||
return Some(string_lit);
|
||||
return wrap_str(string_lit, context.config.max_width(), shape);
|
||||
}
|
||||
}
|
||||
|
||||
if !context.config.force_format_strings()
|
||||
&& !string_requires_rewrite(context, span, &string_lit, shape)
|
||||
{
|
||||
return Some(string_lit);
|
||||
return wrap_str(string_lit, context.config.max_width(), shape);
|
||||
}
|
||||
|
||||
// Remove the quote characters.
|
||||
|
Loading…
Reference in New Issue
Block a user