Skip to content

Conversation

fanyang89
Copy link

Fix the following compile warning:

warning: hiding a lifetime that's elided elsewhere is confusing
  --> src/query_result.rs:24:28
   |
24 |     pub fn data_utf8_lossy(&self) -> Cow<str> {
   |                            ^^^^^     ^^^^^^^^ 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
   |
24 |     pub fn data_utf8_lossy(&self) -> Cow<'_, str> {
   |                                          +++

@CLAassistant
Copy link

CLAassistant commented Sep 4, 2025

CLA assistant check
All committers have signed the CLA.

@kafka1991
Copy link

kafka1991 commented Sep 5, 2025

Hi @fanyang89

Thanks for your contribution!

May I ask what phase the compile warning reported? Is cargo clippy or cargo build?

Which cargo or rustc version are you using?

(Here the lifetime can be actually infered by compiler)

@fanyang89
Copy link
Author

Hi @fanyang89

Thanks for your contribution!

May I ask what phase the compile warning reported? Is cargo clippy or cargo build?

Which cargo or rustc version are you using?

(Here the lifetime can be actually infered by compiler)

Hello @kafka1991 ! I'm using the latest stable rustc 1.89.0, the lint(mismatched lifetime syntaxes lint) is introduced in Rust 1.89.0. Here is the release note: Announcing Rust 1.89.0.

And the reproduce steps:

-> % uname -a
Linux gmk.fuis.me 6.16.4-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 28 Aug 2025 19:49:53 +0000 x86_64 GNU/Linux

-> % rustup default stable
info: using existing install for 'stable-x86_64-unknown-linux-gnu'
info: default toolchain set to 'stable-x86_64-unknown-linux-gnu'

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.89.0 (29483883e 2025-08-04)

-> % cargo clean
     Removed 386 files, 186.6MiB total

-> % cargo build
   Compiling proc-macro2 v1.0.101
   // ...
   Compiling chdb-rust v1.0.0 (/home/fanmi/workspace/chdb-rust)
warning: hiding a lifetime that's elided elsewhere is confusing
  --> src/query_result.rs:24:28
   |
24 |     pub fn data_utf8_lossy(&self) -> Cow<str> {
   |                            ^^^^^     -------- 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
   |
24 |     pub fn data_utf8_lossy(&self) -> Cow<'_, str> {
   |                                          +++

warning: `chdb-rust` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.51s

-> % cargo rustc -- --version
   Compiling chdb-rust v1.0.0 (/home/fanmi/workspace/chdb-rust)
rustc 1.89.0 (29483883e 2025-08-04)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.02s

@kafka1991
Copy link

LGTM @auxten Please take a look.

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.

3 participants