Skip to content

Commit

Permalink
Ignore interior mutability of Resource
Browse files Browse the repository at this point in the history
  • Loading branch information
fuzzypixelz committed Jul 25, 2024
1 parent b32da82 commit c4d50f6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# NOTE: Resources are hashed using their `.suffix` field without using any interior mutable fields.
# See https://github.com/eclipse-zenoh/zenoh/blob/b55c781220d7ea9f7f117570990f6e4e063e58fe/zenoh/src/net/routing/dispatcher/resource.rs#L193
# A corresponding comment is present in the `Hash` implementation of `Ressource` as a reminder that this configuration is set.

Check warning on line 3 in clippy.toml

View workflow job for this annotation

GitHub Actions / Typos Check

"Ressource" should be "Resource".
ignore-interior-mutability = [
"zenoh::net::routing::dispatcher::resource::Resource",
]
4 changes: 4 additions & 0 deletions zenoh/src/net/routing/dispatcher/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ impl PartialEq for Resource {
}
impl Eq for Resource {}

// NOTE: The `clippy::mutable_key_type` lint takes issue with the fact that `Resource` contains
// interior mutable data. A configuration option is used to assert that the accessed fields are
// not interior mutable in clippy.toml. Thus care should be taken to ensure soundness of this impl
// as Clippy will not warn about its usage in sets/maps.
impl Hash for Resource {
fn hash<H: Hasher>(&self, state: &mut H) {
self.expr().hash(state);
Expand Down

0 comments on commit c4d50f6

Please sign in to comment.