Skip to content

Consider adding #[must_use] in Colorize methods #198

@synek317

Description

@synek317

It makes a lot of sense to add #[must_use] for methods in the Colorize trait.

I discovered It funnily by writing this code:

fn foo(s: &mut str) {
  // ...
  s.clear();
}

Of course, I should have used &mut String for my mutable buffer. But this compiled just fine since it calls Colorized::clear. With #[must_use], it would be easier to spot.

Even without this example, I think #[must_use] is a viable addition.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions