Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

commented-out-code

Level: warn · Article: Comments

You have git. There is no temporary.

What it checks

A comment block that parses as Rust and carries syntax prose does not use (;, {, (), =, ::, ->). Doc comments are never checked; a comment can legitimately show code.

Don’t

#![allow(unused)]
fn main() {
fn total(items: &[Item]) -> Money {
    // let discount = apply_coupon(&items);
    // items.iter().map(|i| i.price - discount).sum()
    items.iter().map(|i| i.price).sum()
}
}

It creates noise, confuses the reader about what runs, and never gets cleaned up.

Do

#![allow(unused)]
fn main() {
fn total(items: &[Item]) -> Money {
    items.iter().map(|i| i.price).sum()
}
}

If you need it back, git log exists. If you cannot find it there, you did not need it.

Silence it

#![allow(unused)]
fn main() {
// rabot: allow(commented-out-code) the two lines below are the shape of the RFC-12 payload, kept for reference
}