[PR #1350] [CLOSED] Fix lifetime annotation warnings in attribute resolution functions #1270

Closed
opened 2026-02-27 09:11:34 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/lldap/lldap/pull/1350
Author: @Copilot
Created: 11/16/2025
Status: Closed

Base: mainHead: copilot/fix-opensuse-warnings


📝 Commits (2)

  • ac0e078 Initial plan
  • 543d5b1 Add explicit lifetime annotations to fix openSUSE warnings

📊 Changes

1 file changed (+2 additions, -17 deletions)

View changed files

📝 app/src/infra/attributes.rs (+2 -17)

📄 Description

Fix openSUSE Build Warnings for Lifetime Annotations

This PR addresses compiler warnings reported when building lldap 0.6.2 on openSUSE with newer Rust compilers.

Changes Made

  • Reverted file to v0.6.2 state (without lifetime annotations)
  • Added explicit <'_> lifetime annotations to four functions in app/src/infra/attributes.rs:
    • resolve_group_attribute_descriptionOption<AttributeDescription<'_>>
    • resolve_group_attribute_description_or_defaultAttributeDescription<'_>
    • resolve_user_attribute_descriptionOption<AttributeDescription<'_>>
    • resolve_user_attribute_description_or_defaultAttributeDescription<'_>
  • Verified build completes without warnings
  • Verified mismatched_lifetime_syntaxes lint produces no warnings
  • All tests pass

Issue Details

The openSUSE build for lldap 0.6.2 emitted warnings about "hiding a lifetime that's elided elsewhere is confusing" (mismatched_lifetime_syntaxes lint). The fix explicitly adds the '_ lifetime parameter to return types where the lifetime is inferred from the &str parameter, making the signature clearer and eliminating the warnings.

Testing Results

  • Build: No warnings
  • Specific lint check: No mismatched_lifetime_syntaxes warnings
  • Tests: All tests pass
  • No behavior changes

Fixes #1345

Original prompt

This section details on the original issue you should resolve

<issue_title>Building 0.6.2 for openSUSE emits warnings with "warning: hiding a lifetime that's elided elsewhere is confusing"</issue_title>
<issue_description>Dear maintainers,

the openSUSE package for lldap 0.6.2 emits the following warning messages. Those do not seem to be critical, but I wanted to report them nevertheless.

[  647s]    Compiling url-escape v0.1.1
[  647s]    Compiling lldap_validation v0.6.0 (/home/abuild/rpmbuild/BUILD/lldap-0.6.2-build/lldap-0.6.2/crates/validation)
[  649s]    Compiling lldap_app v0.6.2 (/home/abuild/rpmbuild/BUILD/lldap-0.6.2-build/lldap-0.6.2/app)
[  652s] warning: hiding a lifetime that's elided elsewhere is confusing
[  652s]   --> app/src/infra/attributes.rs:11:54
[  652s]    |
[  652s] 11 |     pub fn resolve_group_attribute_description(name: &str) -> Option<AttributeDescription> {
[  652s]    |                                                      ^^^^            -------------------- the same lifetime is hidden here
[  652s]    |                                                      |
[  652s]    |                                                      the lifetime is elided here
[  652s]    |
[  652s]    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
[  652s]    = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default
[  652s] help: use `'_` for type paths
[  652s]    |
[  652s] 11 |     pub fn resolve_group_attribute_description(name: &str) -> Option<AttributeDescription<'_>> {
[  652s]    |                                                                                          ++++
[  652s] 
[  652s] warning: hiding a lifetime that's elided elsewhere is confusing
[  652s]   --> app/src/infra/attributes.rs:37:65
[  652s]    |
[  652s] 37 |     pub fn resolve_group_attribute_description_or_default(name: &str) -> AttributeDescription {
[  652s]    |                                                                 ^^^^     -------------------- the same lifetime is hidden here
[  652s]    |                                                                 |
[  652s]    |                                                                 the lifetime is elided here
[  652s]    |
[  652s]    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
[  652s] help: use `'_` for type paths
[  652s]    |
[  652s] 37 |     pub fn resolve_group_attribute_description_or_default(name: &str) -> AttributeDescription<'_> {
[  652s]    |                                                                                              ++++
[  652s] 
[  652s] warning: hiding a lifetime that's elided elsewhere is confusing
[  652s]   --> app/src/infra/attributes.rs:53:53
[  652s]    |
[  652s] 53 |     pub fn resolve_user_attribute_description(name: &str) -> Option<AttributeDescription> {
[  652s]    |                                                     ^^^^            -------------------- the same lifetime is hidden here
[  652s]    |                                                     |
[  652s]    |                                                     the lifetime is elided here
[  652s]    |
[  652s]    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
[  652s] help: use `'_` for type paths
[  652s]    |
[  652s] 53 |     pub fn resolve_user_attribute_description(name: &str) -> Option<AttributeDescription<'_>> {
[  652s]    |                                                                                         ++++
[  652s] 
[  652s] warning: hiding a lifetime that's elided elsewhere is confusing
[  652s]   --> app/src/infra/attributes.rs:99:64
[  652s]    |
[  652s] 99 |     pub fn resolve_user_attribute_description_or_default(name: &str) -> AttributeDescription {
[  652s]    |                                                                ^^^^     -------------------- the same lifetime is hidden here
[  652s]    |                                                                |
[  652s]    |                                                                the lifetime is elided here
[  652s]    |
[  652s]    = help: the same lifetime is referred to in inconsistent ways, making the signature confusing
[  652s] help: use `'_` for type paths
[  652s]    |
[  652s] 99 |     pub fn resolve_user_attribute_description_or_default(name: &str) -> AttributeDescription<'_> {
[  652s]    |                                                                                             ++++
[  652s] 
[  685s] warning: `lldap_app` (lib) generated 4 warnings

Kind Regards,
Johannes</issue_description>

Comments on the Issue (you are @copilot in this section)

@nitnelave This looks like openSuse compiled LLDAP with a more recent `rustc` than our MSRV. That's totally fine, and I appreciate the report! I'll have a look when I can (or see if we can so...

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/lldap/lldap/pull/1350 **Author:** [@Copilot](https://github.com/apps/copilot-swe-agent) **Created:** 11/16/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `copilot/fix-opensuse-warnings` --- ### 📝 Commits (2) - [`ac0e078`](https://github.com/lldap/lldap/commit/ac0e0780e99bed866cca97ff819dceb84a7551c0) Initial plan - [`543d5b1`](https://github.com/lldap/lldap/commit/543d5b11dbedddc25fb2e924d38067ba8c71f593) Add explicit lifetime annotations to fix openSUSE warnings ### 📊 Changes **1 file changed** (+2 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `app/src/infra/attributes.rs` (+2 -17) </details> ### 📄 Description ## Fix openSUSE Build Warnings for Lifetime Annotations This PR addresses compiler warnings reported when building lldap 0.6.2 on openSUSE with newer Rust compilers. ### Changes Made - [x] Reverted file to v0.6.2 state (without lifetime annotations) - [x] Added explicit `<'_>` lifetime annotations to four functions in `app/src/infra/attributes.rs`: - `resolve_group_attribute_description` → `Option<AttributeDescription<'_>>` - `resolve_group_attribute_description_or_default` → `AttributeDescription<'_>` - `resolve_user_attribute_description` → `Option<AttributeDescription<'_>>` - `resolve_user_attribute_description_or_default` → `AttributeDescription<'_>` - [x] Verified build completes without warnings - [x] Verified `mismatched_lifetime_syntaxes` lint produces no warnings - [x] All tests pass ### Issue Details The openSUSE build for lldap 0.6.2 emitted warnings about "hiding a lifetime that's elided elsewhere is confusing" (`mismatched_lifetime_syntaxes` lint). The fix explicitly adds the `'_` lifetime parameter to return types where the lifetime is inferred from the `&str` parameter, making the signature clearer and eliminating the warnings. ### Testing Results - ✅ Build: No warnings - ✅ Specific lint check: No `mismatched_lifetime_syntaxes` warnings - ✅ Tests: All tests pass - ✅ No behavior changes Fixes #1345 <!-- START COPILOT CODING AGENT SUFFIX --> <details> <summary>Original prompt</summary> ---- *This section details on the original issue you should resolve* <issue_title>Building 0.6.2 for openSUSE emits warnings with "warning: hiding a lifetime that's elided elsewhere is confusing"</issue_title> <issue_description>Dear maintainers, the openSUSE package for lldap 0.6.2 emits the following warning messages. Those do not seem to be critical, but I wanted to report them nevertheless. ``` [ 647s] Compiling url-escape v0.1.1 [ 647s] Compiling lldap_validation v0.6.0 (/home/abuild/rpmbuild/BUILD/lldap-0.6.2-build/lldap-0.6.2/crates/validation) [ 649s] Compiling lldap_app v0.6.2 (/home/abuild/rpmbuild/BUILD/lldap-0.6.2-build/lldap-0.6.2/app) [ 652s] warning: hiding a lifetime that's elided elsewhere is confusing [ 652s] --> app/src/infra/attributes.rs:11:54 [ 652s] | [ 652s] 11 | pub fn resolve_group_attribute_description(name: &str) -> Option<AttributeDescription> { [ 652s] | ^^^^ -------------------- the same lifetime is hidden here [ 652s] | | [ 652s] | the lifetime is elided here [ 652s] | [ 652s] = help: the same lifetime is referred to in inconsistent ways, making the signature confusing [ 652s] = note: `#[warn(mismatched_lifetime_syntaxes)]` on by default [ 652s] help: use `'_` for type paths [ 652s] | [ 652s] 11 | pub fn resolve_group_attribute_description(name: &str) -> Option<AttributeDescription<'_>> { [ 652s] | ++++ [ 652s] [ 652s] warning: hiding a lifetime that's elided elsewhere is confusing [ 652s] --> app/src/infra/attributes.rs:37:65 [ 652s] | [ 652s] 37 | pub fn resolve_group_attribute_description_or_default(name: &str) -> AttributeDescription { [ 652s] | ^^^^ -------------------- the same lifetime is hidden here [ 652s] | | [ 652s] | the lifetime is elided here [ 652s] | [ 652s] = help: the same lifetime is referred to in inconsistent ways, making the signature confusing [ 652s] help: use `'_` for type paths [ 652s] | [ 652s] 37 | pub fn resolve_group_attribute_description_or_default(name: &str) -> AttributeDescription<'_> { [ 652s] | ++++ [ 652s] [ 652s] warning: hiding a lifetime that's elided elsewhere is confusing [ 652s] --> app/src/infra/attributes.rs:53:53 [ 652s] | [ 652s] 53 | pub fn resolve_user_attribute_description(name: &str) -> Option<AttributeDescription> { [ 652s] | ^^^^ -------------------- the same lifetime is hidden here [ 652s] | | [ 652s] | the lifetime is elided here [ 652s] | [ 652s] = help: the same lifetime is referred to in inconsistent ways, making the signature confusing [ 652s] help: use `'_` for type paths [ 652s] | [ 652s] 53 | pub fn resolve_user_attribute_description(name: &str) -> Option<AttributeDescription<'_>> { [ 652s] | ++++ [ 652s] [ 652s] warning: hiding a lifetime that's elided elsewhere is confusing [ 652s] --> app/src/infra/attributes.rs:99:64 [ 652s] | [ 652s] 99 | pub fn resolve_user_attribute_description_or_default(name: &str) -> AttributeDescription { [ 652s] | ^^^^ -------------------- the same lifetime is hidden here [ 652s] | | [ 652s] | the lifetime is elided here [ 652s] | [ 652s] = help: the same lifetime is referred to in inconsistent ways, making the signature confusing [ 652s] help: use `'_` for type paths [ 652s] | [ 652s] 99 | pub fn resolve_user_attribute_description_or_default(name: &str) -> AttributeDescription<'_> { [ 652s] | ++++ [ 652s] [ 685s] warning: `lldap_app` (lib) generated 4 warnings ``` Kind Regards, Johannes</issue_description> ## Comments on the Issue (you are @copilot in this section) <comments> <comment_new><author>@nitnelave</author><body> This looks like openSuse compiled LLDAP with a more recent `rustc` than our MSRV. That's totally fine, and I appreciate the report! I'll have a look when I can (or see if we can so... </details> - Fixes lldap/lldap#1345 <!-- START COPILOT CODING AGENT TIPS --> --- 💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more [Copilot coding agent tips](https://gh.io/copilot-coding-agent-tips) in the docs. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-02-27 09:11:34 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/lldap-lldap#1270
No description provided.