Home / Docs / Diagnostics
U3017: of clause that names no parameter
Release v0.4.0
In edition 0.2, a function header can write uses of p and fails of p: the function performs the effects, and passes the failures, of whatever function its parameter p receives (ADR 0062, spec/05 §9 rule 9). p MUST be one of the function's own parameters. A name that is no parameter, often a typo or a parameter renamed later, is U3017 at the name in the clause.
The repair at a glance
src/demo.una
module demo
pub apply_all(xs: List[Int], each: fn(Int) -> Unit) -> Unit
- uses of action
+ uses of each
=
for x in xs
each(x)Failing example
una.toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.2"src/demo.una
module demo
pub apply_all(xs: List[Int], each: fn(Int) -> Unit) -> Unit
uses of action
=
for x in xs
each(x)Fixed example
una.toml
[package]
name = "demo"
version = "0.1.0"
edition = "0.2"src/demo.una
module demo
pub apply_all(xs: List[Int], each: fn(Int) -> Unit) -> Unit
uses of each
=
for x in xs
each(x)