Skip to content

fix: add explicit lifetime annotations to silence rust 1.94 warnings#61

Open
publicmatt wants to merge 1 commit intograspologic-org:devfrom
publicmatt:fix/lifetime-syntax-warnings
Open

fix: add explicit lifetime annotations to silence rust 1.94 warnings#61
publicmatt wants to merge 1 commit intograspologic-org:devfrom
publicmatt:fix/lifetime-syntax-warnings

Conversation

@publicmatt
Copy link
Copy Markdown

the mismatched_lifetime_syntaxes lint now warns when elided lifetimes are inconsistent between &self and the return type. adds '_ to three return types in network_partitions.

When I tried to use this as a dependency, rustc gave the following errors:

warning: hiding a lifetime that's elided elsewhere is confusing
  --> vendor/graspologic-native/packages/network_partitions/src/leiden/neighboring_clusters.rs:64:17
   |
64 |     pub fn iter(&self) -> Iter<usize> {
   |                 ^^^^^     ^^^^^^^^^^^ the same lifetime is hidden here
   |                 |
   |                 the lifetime is elided here
   |
   = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
   = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
help: use `'_` for type paths
   |
64 |     pub fn iter(&self) -> Iter<'_, usize> {
   |                                +++

warning: hiding a lifetime that's elided elsewhere is confusing
   --> vendor/graspologic-native/packages/network_partitions/src/network/compact_network.rs:155:9
    |
155 |         &self,
    |         ^^^^^ the lifetime is elided here
156 |         id: CompactNodeId,
157 |     ) -> CompactNodeItem {
    |          ^^^^^^^^^^^^^^^ the same lifetime is hidden here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
    |
157 |     ) -> CompactNodeItem<'_> {
    |                         ++++

warning: hiding a lifetime that's elided elsewhere is confusing
   --> vendor/graspologic-native/packages/network_partitions/src/network/compact_network.rs:167:9
    |
167 |         &self,
    |         ^^^^^ the lifetime is elided here
168 |         id: CompactNodeId,
169 |     ) -> NeighborIterator {
    |          ^^^^^^^^^^^^^^^^ the same lifetime is hidden here
    |
    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
help: use `'_` for type paths
    |
169 |     ) -> NeighborIterator<'_> {
    |                          ++++

warning: `network_partitions` (lib) generated 3 warnings (run `cargo fix --lib -p network_partitions` to apply 3 suggestions)

the `mismatched_lifetime_syntaxes` lint now warns when elided lifetimes
are inconsistent between `&self` and the return type.
adds `'_` to three return types in network_partitions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant