is_from_for_loop: document what first check matches

Removing the first check will break a lot of for-loop UI tests and the
dogfood test.
This commit is contained in:
Joonas Koivunen 2017-08-18 17:12:00 +03:00
parent cf8e95eb22
commit a5147e8a08

View file

@ -114,6 +114,13 @@ pub fn range(expr: &hir::Expr) -> Option<Range> {
/// Checks if a `let` decl is from a `for` loop desugaring.
pub fn is_from_for_desugar(decl: &hir::Decl) -> bool {
// This will detect plain for-loops without an actual variable binding:
//
// ```
// for x in some_vec {
// // do stuff
// }
// ```
if_let_chain! {[
let hir::DeclLocal(ref loc) = decl.node,
let Some(ref expr) = loc.init,