E3027#
guard! cannot have an else clause. It is the explicit form of a terminating
guard: when its condition is false or its pattern does not match, the program
terminates.
Erroneous example#
///|
pub fn require(condition : Bool) -> Bool {
guard! condition else { false }
true
}
Suggestion#
Use guard when an else clause is needed.
///|
pub fn require(condition : Bool) -> Bool {
guard condition else { false }
true
}