Skip to content

or-fun-call macro suggestion bug #1018

Closed
@lrbalt

Description

@lrbalt

I have this code:

r.view_args
     .get(name)
     .ok_or(format!("{} not given", name))

Clippy reports:

src/app/app_server.rs:259:5: 261:43 warning: use of `ok_or` followed by a function call, #[warn(or_fun_call)] on by default
src/app/app_server.rs:259     r.view_args
                              ^
src/app/app_server.rs:259:5: 261:43 help: for further information visit https://github.com/Manishearth/rust-clippy/wiki#or_fun_call
src/app/app_server.rs:259:5: 261:43 help: try this
src/app/app_server.rs:        r.view_args
src/app/app_server.rs:         .get(name).ok_or_else(|| $ crate :: fmt :: format ( format_args ! ( $ ( $ arg ) * ) ))

Perhaps Clippy should ignore .ok_or(macro!()) constructs?

Metadata

Metadata

Assignees

Labels

C-bugCategory: Clippy is not doing the correct thingC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesT-macrosType: Issues with macros and macro expansion

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions