Skip to content

Clippy warning on const ArcStr literal #64

Description

@kxxt

I am getting the following clippy warning when using const ArcStr literals. IMO these warnings are harmless. It's probably a good idea to silence such warnings in arcstr::literal macro.

warning: a `const` item should never be interior mutable
   --> src/regex.rs:305:1
    |
305 | pub const SPACE: ArcStr = arcstr::literal!(" ");
    | -----^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    | |
    | make this a static item (maybe with lazy_static)
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#declare_interior_mutable_const
    = note: `#[warn(clippy::declare_interior_mutable_const)]` on by default
warning: a `const` item with interior mutability should not be borrowed
   --> src/tracer/state.rs:231:22
    |
231 |         let space = &SPACE;
    |                      ^^^^^
    |
    = help: assign this const to a local or static variable, and use the variable here
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#borrow_interior_mutable_const
    = note: `#[warn(clippy::borrow_interior_mutable_const)]` on by default

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions