while let all the things
This commit is contained in:
parent
e2746d8700
commit
2e7e68b762
6 changed files with 20 additions and 50 deletions
|
@ -2208,13 +2208,8 @@ impl<'a> State<'a> {
|
||||||
if self.next_comment().is_none() {
|
if self.next_comment().is_none() {
|
||||||
self.s.hardbreak()?;
|
self.s.hardbreak()?;
|
||||||
}
|
}
|
||||||
loop {
|
while let Some(ref cmnt) = self.next_comment() {
|
||||||
match self.next_comment() {
|
self.print_comment(cmnt)?
|
||||||
Some(ref cmnt) => {
|
|
||||||
self.print_comment(cmnt)?;
|
|
||||||
}
|
|
||||||
_ => break,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,11 +206,7 @@ impl<'a, 'tcx> ReachableContext<'a, 'tcx> {
|
||||||
// Step 2: Mark all symbols that the symbols on the worklist touch.
|
// Step 2: Mark all symbols that the symbols on the worklist touch.
|
||||||
fn propagate(&mut self) {
|
fn propagate(&mut self) {
|
||||||
let mut scanned = FxHashSet();
|
let mut scanned = FxHashSet();
|
||||||
loop {
|
while let Some(search_item) = self.worklist.pop() {
|
||||||
let search_item = match self.worklist.pop() {
|
|
||||||
Some(item) => item,
|
|
||||||
None => break,
|
|
||||||
};
|
|
||||||
if !scanned.insert(search_item) {
|
if !scanned.insert(search_item) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
|
@ -415,13 +415,7 @@ impl<O: ForestObligation> ObligationForest<O> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {
|
while let Some(i) = error_stack.pop() {
|
||||||
// non-standard `while let` to bypass #6393
|
|
||||||
let i = match error_stack.pop() {
|
|
||||||
Some(i) => i,
|
|
||||||
None => break
|
|
||||||
};
|
|
||||||
|
|
||||||
let node = &self.nodes[i];
|
let node = &self.nodes[i];
|
||||||
|
|
||||||
match node.state.get() {
|
match node.state.get() {
|
||||||
|
|
|
@ -428,20 +428,15 @@ impl fmt::Debug for Wtf8 {
|
||||||
|
|
||||||
formatter.write_str("\"")?;
|
formatter.write_str("\"")?;
|
||||||
let mut pos = 0;
|
let mut pos = 0;
|
||||||
loop {
|
while let Some((surrogate_pos, surrogate)) = self.next_surrogate(pos) {
|
||||||
match self.next_surrogate(pos) {
|
write_str_escaped(
|
||||||
None => break,
|
formatter,
|
||||||
Some((surrogate_pos, surrogate)) => {
|
unsafe { str::from_utf8_unchecked(
|
||||||
write_str_escaped(
|
&self.bytes[pos .. surrogate_pos]
|
||||||
formatter,
|
)},
|
||||||
unsafe { str::from_utf8_unchecked(
|
)?;
|
||||||
&self.bytes[pos .. surrogate_pos]
|
write!(formatter, "\\u{{{:x}}}", surrogate)?;
|
||||||
)},
|
pos = surrogate_pos + 3;
|
||||||
)?;
|
|
||||||
write!(formatter, "\\u{{{:x}}}", surrogate)?;
|
|
||||||
pos = surrogate_pos + 3;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
write_str_escaped(
|
write_str_escaped(
|
||||||
formatter,
|
formatter,
|
||||||
|
|
|
@ -732,18 +732,13 @@ pub fn expand_preparsed_format_args(ecx: &mut ExtCtxt,
|
||||||
let mut parser = parse::Parser::new(fmt_str);
|
let mut parser = parse::Parser::new(fmt_str);
|
||||||
let mut pieces = vec![];
|
let mut pieces = vec![];
|
||||||
|
|
||||||
loop {
|
while let Some(mut piece) = parser.next() {
|
||||||
match parser.next() {
|
if !parser.errors.is_empty() {
|
||||||
Some(mut piece) => {
|
break;
|
||||||
if !parser.errors.is_empty() {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
cx.verify_piece(&piece);
|
|
||||||
cx.resolve_name_inplace(&mut piece);
|
|
||||||
pieces.push(piece);
|
|
||||||
}
|
|
||||||
None => break,
|
|
||||||
}
|
}
|
||||||
|
cx.verify_piece(&piece);
|
||||||
|
cx.resolve_name_inplace(&mut piece);
|
||||||
|
pieces.push(piece);
|
||||||
}
|
}
|
||||||
|
|
||||||
let numbered_position_args = pieces.iter().any(|arg: &parse::Piece| {
|
let numbered_position_args = pieces.iter().any(|arg: &parse::Piece| {
|
||||||
|
|
|
@ -322,12 +322,7 @@ impl Span {
|
||||||
pub fn macro_backtrace(mut self) -> Vec<MacroBacktrace> {
|
pub fn macro_backtrace(mut self) -> Vec<MacroBacktrace> {
|
||||||
let mut prev_span = DUMMY_SP;
|
let mut prev_span = DUMMY_SP;
|
||||||
let mut result = vec![];
|
let mut result = vec![];
|
||||||
loop {
|
while let Some(info) = self.ctxt().outer().expn_info() {
|
||||||
let info = match self.ctxt().outer().expn_info() {
|
|
||||||
Some(info) => info,
|
|
||||||
None => break,
|
|
||||||
};
|
|
||||||
|
|
||||||
let (pre, post) = match info.callee.format {
|
let (pre, post) = match info.callee.format {
|
||||||
ExpnFormat::MacroAttribute(..) => ("#[", "]"),
|
ExpnFormat::MacroAttribute(..) => ("#[", "]"),
|
||||||
ExpnFormat::MacroBang(..) => ("", "!"),
|
ExpnFormat::MacroBang(..) => ("", "!"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue