Per discussion that began on #438.
Some of the exercise stubs currently use _ as a parameter for their input. This is confusing for beginners since _ binds any pattern (it serves as the default case in matches) and is prefixed to a variable to suppress an underscore.
This is currently used in function stubs as a way of reducing the initial number of compiler warnings encountered on the Rust track and most of these stubs have a body of unimplemented!() and nothing more.
However, in most cases we should be able to easily turn the function input into a regular parameter and avoid compiler warnings by referencing it in the body of our function. So the normal stub:
pub fn exercise(_: &str) -> bool {
unimplemented!()
}
becomes
pub fn exercise(input: &str) -> bool {
unimplemented!("There's an easy way to reference your input variable: {}", input)
}
A quick rg -e 'pub fn \w+\(_' --count | sort | cut -f 1 -d '/' shows which exercises are affected (caveat: this might miss some).
Per discussion that began on #438.
Some of the exercise stubs currently use
_as a parameter for their input. This is confusing for beginners since_binds any pattern (it serves as the default case in matches) and is prefixed to a variable to suppress an underscore.This is currently used in function stubs as a way of reducing the initial number of compiler warnings encountered on the Rust track and most of these stubs have a body of
unimplemented!()and nothing more.However, in most cases we should be able to easily turn the function input into a regular parameter and avoid compiler warnings by referencing it in the body of our function. So the normal stub:
becomes
A quick
rg -e 'pub fn \w+\(_' --count | sort | cut -f 1 -d '/'shows which exercises are affected (caveat: this might miss some).