allow or avoid for loops over option in compiler and tests
This commit is contained in:
parent
8ca57b54c1
commit
0250f0244b
3 changed files with 14 additions and 15 deletions
|
@ -244,14 +244,12 @@ pub trait Visitor<'ast>: Sized {
|
||||||
|
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! walk_list {
|
macro_rules! walk_list {
|
||||||
($visitor: expr, $method: ident, $list: expr) => {
|
($visitor: expr, $method: ident, $list: expr $(, $($extra_args: expr),* )?) => {
|
||||||
for elem in $list {
|
{
|
||||||
$visitor.$method(elem)
|
#[cfg_attr(not(bootstrap), allow(for_loop_over_fallibles))]
|
||||||
}
|
for elem in $list {
|
||||||
};
|
$visitor.$method(elem $(, $($extra_args,)* )?)
|
||||||
($visitor: expr, $method: ident, $list: expr, $($extra_args: expr),*) => {
|
}
|
||||||
for elem in $list {
|
|
||||||
$visitor.$method(elem, $($extra_args,)*)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1017,7 +1017,7 @@ impl<'a> Children<'a> for HM<'a> {
|
||||||
where C: Context + PrePost<Self>, Self: Sized
|
where C: Context + PrePost<Self>, Self: Sized
|
||||||
{
|
{
|
||||||
if let Some(ref hm) = self.contents.get() {
|
if let Some(ref hm) = self.contents.get() {
|
||||||
for (k, v) in hm.iter().nth(index / 2) {
|
if let Some((k, v)) = hm.iter().nth(index / 2) {
|
||||||
[k, v][index % 2].descend_into_self(context);
|
[k, v][index % 2].descend_into_self(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1032,7 +1032,7 @@ impl<'a> Children<'a> for VD<'a> {
|
||||||
where C: Context + PrePost<Self>, Self: Sized
|
where C: Context + PrePost<Self>, Self: Sized
|
||||||
{
|
{
|
||||||
if let Some(ref vd) = self.contents.get() {
|
if let Some(ref vd) = self.contents.get() {
|
||||||
for r in vd.iter().nth(index) {
|
if let Some(r) = vd.iter().nth(index) {
|
||||||
r.descend_into_self(context);
|
r.descend_into_self(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1047,7 +1047,7 @@ impl<'a> Children<'a> for VM<'a> {
|
||||||
where C: Context + PrePost<VM<'a>>
|
where C: Context + PrePost<VM<'a>>
|
||||||
{
|
{
|
||||||
if let Some(ref vd) = self.contents.get() {
|
if let Some(ref vd) = self.contents.get() {
|
||||||
for (_idx, r) in vd.iter().nth(index) {
|
if let Some((_idx, r)) = vd.iter().nth(index) {
|
||||||
r.descend_into_self(context);
|
r.descend_into_self(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1062,7 +1062,7 @@ impl<'a> Children<'a> for LL<'a> {
|
||||||
where C: Context + PrePost<LL<'a>>
|
where C: Context + PrePost<LL<'a>>
|
||||||
{
|
{
|
||||||
if let Some(ref ll) = self.contents.get() {
|
if let Some(ref ll) = self.contents.get() {
|
||||||
for r in ll.iter().nth(index) {
|
if let Some(r) = ll.iter().nth(index) {
|
||||||
r.descend_into_self(context);
|
r.descend_into_self(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1077,7 @@ impl<'a> Children<'a> for BH<'a> {
|
||||||
where C: Context + PrePost<BH<'a>>
|
where C: Context + PrePost<BH<'a>>
|
||||||
{
|
{
|
||||||
if let Some(ref bh) = self.contents.get() {
|
if let Some(ref bh) = self.contents.get() {
|
||||||
for r in bh.iter().nth(index) {
|
if let Some(r) = bh.iter().nth(index) {
|
||||||
r.descend_into_self(context);
|
r.descend_into_self(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1092,7 +1092,7 @@ impl<'a> Children<'a> for BTM<'a> {
|
||||||
where C: Context + PrePost<BTM<'a>>
|
where C: Context + PrePost<BTM<'a>>
|
||||||
{
|
{
|
||||||
if let Some(ref bh) = self.contents.get() {
|
if let Some(ref bh) = self.contents.get() {
|
||||||
for (k, v) in bh.iter().nth(index / 2) {
|
if let Some((k, v)) = bh.iter().nth(index / 2) {
|
||||||
[k, v][index % 2].descend_into_self(context);
|
[k, v][index % 2].descend_into_self(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1107,7 +1107,7 @@ impl<'a> Children<'a> for BTS<'a> {
|
||||||
where C: Context + PrePost<BTS<'a>>
|
where C: Context + PrePost<BTS<'a>>
|
||||||
{
|
{
|
||||||
if let Some(ref bh) = self.contents.get() {
|
if let Some(ref bh) = self.contents.get() {
|
||||||
for r in bh.iter().nth(index) {
|
if let Some(r) = bh.iter().nth(index) {
|
||||||
r.descend_into_self(context);
|
r.descend_into_self(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
// run-pass
|
// run-pass
|
||||||
#![allow(unreachable_code)]
|
#![allow(unreachable_code)]
|
||||||
|
#![allow(for_loop_over_fallibles)]
|
||||||
#![deny(unused_variables)]
|
#![deny(unused_variables)]
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue