Add unreachable comments.
This commit is contained in:
parent
f85ad28e93
commit
e8d6e3f57d
@ -200,7 +200,7 @@ pub fn generate_body(
|
|||||||
|
|
||||||
let ns_str = syn::Ident::new(
|
let ns_str = syn::Ident::new(
|
||||||
match namespace {
|
match namespace {
|
||||||
FnNamespaceAccess::Unset => unreachable!(),
|
FnNamespaceAccess::Unset => unreachable!("`namespace` should be set"),
|
||||||
FnNamespaceAccess::Global => "Global",
|
FnNamespaceAccess::Global => "Global",
|
||||||
FnNamespaceAccess::Internal => "Internal",
|
FnNamespaceAccess::Internal => "Internal",
|
||||||
},
|
},
|
||||||
|
@ -895,7 +895,7 @@ fn optimize_stmt(stmt: &mut Stmt, state: &mut OptimizerState, preserve_result: b
|
|||||||
*stmt = stmt_block.into();
|
*stmt = stmt_block.into();
|
||||||
}
|
}
|
||||||
Expr::Stmt(..) => *stmt = Stmt::Noop(expr.position()),
|
Expr::Stmt(..) => *stmt = Stmt::Noop(expr.position()),
|
||||||
_ => unreachable!(),
|
_ => unreachable!("`Expr::Stmt`"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -950,7 +950,7 @@ fn optimize_expr(expr: &mut Expr, state: &mut OptimizerState, _chaining: bool) {
|
|||||||
optimize_expr(&mut e, state, false);
|
optimize_expr(&mut e, state, false);
|
||||||
*expr = *e;
|
*expr = *e;
|
||||||
}
|
}
|
||||||
_ => unreachable!()
|
_ => unreachable!("`Expr::Stmt`")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// { stmt; ... } - do not count promotion as dirty because it gets turned back into an array
|
// { stmt; ... } - do not count promotion as dirty because it gets turned back into an array
|
||||||
|
@ -105,7 +105,7 @@ impl<T: Debug + Copy + PartialOrd> Iterator for StepRange<T> {
|
|||||||
self.dir = 0;
|
self.dir = 0;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
unreachable!();
|
unreachable!("`dir` != 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(v)
|
Some(v)
|
||||||
|
@ -798,7 +798,7 @@ impl Engine {
|
|||||||
match token {
|
match token {
|
||||||
Token::LeftBracket => ASTFlags::NONE,
|
Token::LeftBracket => ASTFlags::NONE,
|
||||||
Token::QuestionBracket => ASTFlags::NEGATED,
|
Token::QuestionBracket => ASTFlags::NEGATED,
|
||||||
_ => unreachable!(),
|
_ => unreachable!("`[` or `?[`"),
|
||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
settings.level_up(),
|
settings.level_up(),
|
||||||
@ -1693,7 +1693,7 @@ impl Engine {
|
|||||||
let opt = match token {
|
let opt = match token {
|
||||||
Token::LeftBracket => ASTFlags::NONE,
|
Token::LeftBracket => ASTFlags::NONE,
|
||||||
Token::QuestionBracket => ASTFlags::NEGATED,
|
Token::QuestionBracket => ASTFlags::NEGATED,
|
||||||
_ => unreachable!(),
|
_ => unreachable!("`[` or `?[`"),
|
||||||
};
|
};
|
||||||
self.parse_index_chain(input, state, lib, expr, opt, true, settings.level_up())?
|
self.parse_index_chain(input, state, lib, expr, opt, true, settings.level_up())?
|
||||||
}
|
}
|
||||||
@ -1717,7 +1717,7 @@ impl Engine {
|
|||||||
let op_flags = match op {
|
let op_flags = match op {
|
||||||
Token::Period => ASTFlags::NONE,
|
Token::Period => ASTFlags::NONE,
|
||||||
Token::Elvis => ASTFlags::NEGATED,
|
Token::Elvis => ASTFlags::NEGATED,
|
||||||
_ => unreachable!(),
|
_ => unreachable!("`.` or `?.`"),
|
||||||
};
|
};
|
||||||
Self::make_dot_expr(state, expr, rhs, ASTFlags::NONE, op_flags, tail_pos)?
|
Self::make_dot_expr(state, expr, rhs, ASTFlags::NONE, op_flags, tail_pos)?
|
||||||
}
|
}
|
||||||
|
@ -248,7 +248,7 @@ impl fmt::Debug for Position {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "no_position")]
|
#[cfg(feature = "no_position")]
|
||||||
unreachable!();
|
unreachable!("no position");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user