Merge pull request #2153 from topecongiro/issue-2152
Return None when a literal exceeds budget
This commit is contained in:
commit
a90b76a731
@ -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),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -434,3 +434,11 @@ impl<'tcx> Const<'tcx> {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// #2152
|
||||
fn issue_2152() {
|
||||
match m {
|
||||
"aaaaaaaaaaaaa" | "bbbbbbbbbbbbb" | "cccccccccccccccccccccccccccccccccccccccccccc" if true => {}
|
||||
"bind" | "writev" | "readv" | "sendmsg" | "recvmsg" if android && (aarch64 || x86_64) => true,
|
||||
}
|
||||
}
|
||||
|
@ -475,3 +475,14 @@ impl<'tcx> Const<'tcx> {
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// #2152
|
||||
fn issue_2152() {
|
||||
match m {
|
||||
"aaaaaaaaaaaaa" | "bbbbbbbbbbbbb" | "cccccccccccccccccccccccccccccccccccccccccccc"
|
||||
if true => {}
|
||||
"bind" | "writev" | "readv" | "sendmsg" | "recvmsg" if android && (aarch64 || x86_64) => {
|
||||
true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user