Skip to content

temporary_cstring_as_ptr lint doesn't correctly trigger #4312

Closed
@crlf0710

Description

@crlf0710

While let _f = CString::new("foo").unwrap().as_ptr(); correctly triggers temporary_cstring_as_ptr lint, let _f = CString::new("foo").expect("dummy").as_ptr() doesn't. What's the difference between unwrap and expect?

I'm using rustc stable 1.36.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: Clippy is not doing the correct thingC-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesgood-first-issueThese issues are a good way to get started with Clippy

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions