U02

Warning

Declared and never read

U02 — A derived value nothing reads

A derived nothing reads.

What the compiler said

warning[U02]: `doubled` is declared but never read --> src/App.wf:3:5 | 3 | derived doubled = n * 2 | ^^^^^^^ = help: Nothing reads the derived value; remove it, or name it `_doubled` to keep it = docs: https://webfluent.monzeromer.dev/errors/U02

Your editor offers this fix: Remove doubled. wf fix --code U02 applies it to every place it fits.

The fix

Broken

wf

page P(path: "/", title: "T", description: "D") { state n = 1 derived doubled = n * 2 Heading("{n}").h1 }

Fixed

wf

page P(path: "/", title: "T", description: "D") { state n = 1 derived doubled = n * 2 Heading("{n} doubled is {doubled}").h1 }

Remove it or read it; a leading _ keeps it.

Each example is a whole program: it is all of src/App.wf in a project with no other .wf file (trying an example).

lints may lower it:

"lints": { "U02": "off" } // wf-allow(U02)