volo-rs / faststr

`faststr` is a string library that try to avoid the cost of clone.
https://crates.io/crates/faststr
Apache License 2.0
85 stars 7 forks source link

Got `mutable key type` clippy warning when putting `FastStr` type key into a HashMap #4

Closed iamazy closed 1 year ago

iamazy commented 1 year ago

Bug Report

Version

0.2.11

Platform

macos 12.1 M1

Description

The affected code is as follows.

image

when execute cargo clippy, it always got output

warning: mutable key type
  --> helyim/src/directory/topology/volume_grow.rs:67:9
   |
67 |         let data_centers = topology.data_centers().await?;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#mutable_key_type
   = note: `#[warn(clippy::mutable_key_type)]` on by default

How to avoid such warnings?

Maybe it‘s clippy’s bug.

PureWhiteWu commented 1 year ago

Hi, thanks for the report. This is a false positive because FastStr contains Bytes, you can just ignore that lint.

iamazy commented 1 year ago

Got it, thanks!!!