/// Checks that all reasons exist and make sense.
///
/// This function emits errors, if appropriate.
Checks that all reasons exist and make sense.
This function emits errors, if appropriate.
Checks that all reasons exist and make sense . This function emits errors if appropriate .
fn check_reasons(assure_attributes: Vec<AssureAttr>) -> Vec<Precondition> {
    for assure_attribute in assure_attributes.iter() {
        match assure_attribute {
            AssureAttr::WithReason { reason, .. } => {
                if let Some(reason) = unfinished_reason(&reason.reason) {
                    emit_warning!(
                        reason,
                        "you should specify a different here";
                        help = "specifying a meaningful reason will help you and others understand why this is ok in the future"
                    )
                } else if reason.reason.value() == HINT_REASON {
                    let todo_help_msg = if cfg!(nightly) {
                        Some("using `TODO` here will emit a warning, reminding you to fix this later")
                    } else {
                        None
                    };
                    emit_error!(
                        reason.reason,
                        "you need to specify a different reason here";
                        help = "specifying a meaningful reason will help you and others understand why this is ok in the future";
                        help =? todo_help_msg
                    )
                }
            }
            AssureAttr::WithoutReason {
                precondition,
                missing_reason_span,
                ..
            } => emit_error!(
                precondition.span(),
                "you need to specify a reason why this precondition holds";
                help = *missing_reason_span => "add `, reason = {:?}`", HINT_REASON
            ),
        }
    }
    assure_attributes
        .into_iter()
        .map(|holds_statement| holds_statement.into())
        .collect()
}
fn check_reasons ( assure_attributes : Vec < AssureAttr > ) -> Vec < Precondition > { for assure_attribute in assure_attributes . iter ( ) { match assure_attribute { AssureAttr :: WithReason { reason , .. } => { if let Some ( reason ) = unfinished_reason ( & reason . reason ) { emit_warning ! ( reason " " help " " ) } else if reason . reason . value ( ) == HINT_REASON { let todo_help_msg = if cfg ! ( nightly ) { Some ( " " ) } else { None } ; emit_error ! ( reason reason " " help " " help todo_help_msg ) } } AssureAttr :: WithoutReason { precondition , missing_reason_span , .. } => emit_error ! ( precondition span ( ) " " help missing_reason_span " " HINT_REASON ) , } } assure_attributes . into_iter ( ) . map ( | holds_statement | holds_statement . into ( ) ) . collect ( ) }
Checks that all reasons exist and make sense.
Checks that all reasons exist and make sense .
assure_attributes
Vec<AssureAttr>