Skip to content

False postive discarded non-Unit value ... Add : Unit to discard silently #23145

Open
@joan38

Description

@joan38

Compiler version

3.3.5, 3.6.4, 3.7.0

Minimized code

import scribe.*
@main def run: Unit =
  Logger.root.withHandler(minimumLevel = Some(Level.Error)).replace(): Unit

https://scastie.scala-lang.org/a9rhjXNDS72Ve5vg8XOrrw

Output

discarded non-Unit value of type scribe.Logger. Add : Unit to discard silently.

Expectation

The : Unit should remove the warning

Workaround

val _ = Logger.root.withHandler(minimumLevel = Some(Level.Error)).replace()

Thanks

Metadata

Metadata

Assignees

Labels

area:lintingLinting warnings enabled with -W or -Xlintitype:bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions