From c708578598628924b091029182f79db067f5d9b7 Mon Sep 17 00:00:00 2001 From: anotherJJz <470623352@qq.com> Date: Thu, 30 Apr 2026 16:05:03 +0800 Subject: [PATCH] use explicit elided lifetime in Cow signatures --- src/types/args.rs | 6 +++--- src/types/scan.rs | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/types/args.rs b/src/types/args.rs index d207e1ff..5c40a6b5 100644 --- a/src/types/args.rs +++ b/src/types/args.rs @@ -190,7 +190,7 @@ impl Key { } /// Read the key as a lossy UTF8 string with `String::from_utf8_lossy`. - pub fn as_str_lossy(&self) -> Cow { + pub fn as_str_lossy(&self) -> Cow<'_, str> { String::from_utf8_lossy(&self.key) } @@ -976,7 +976,7 @@ impl Value { /// Read the inner value as a string slice. /// /// Null is returned as `"nil"` and scalar values are cast to a string. - pub fn as_str(&self) -> Option> { + pub fn as_str(&self) -> Option> { let s: Cow = match *self { Value::Double(ref f) => Cow::Owned(f.to_string()), Value::Boolean(ref b) => Cow::Owned(b.to_string()), @@ -995,7 +995,7 @@ impl Value { } /// Read the inner value as a string, using `String::from_utf8_lossy` on byte slices. - pub fn as_str_lossy(&self) -> Option> { + pub fn as_str_lossy(&self) -> Option> { let s: Cow = match *self { Value::Boolean(ref b) => Cow::Owned(b.to_string()), Value::Double(ref f) => Cow::Owned(f.to_string()), diff --git a/src/types/scan.rs b/src/types/scan.rs index f4cdf575..1f8eec34 100644 --- a/src/types/scan.rs +++ b/src/types/scan.rs @@ -44,7 +44,7 @@ pub trait Scanner { type Page; /// Read the cursor returned from the last scan operation. - fn cursor(&self) -> Option>; + fn cursor(&self) -> Option>; /// Whether the scan call will continue returning results. If `false` this will be the last result set /// returned on the stream. @@ -110,7 +110,7 @@ impl Drop for ScanResult { impl Scanner for ScanResult { type Page = Vec; - fn cursor(&self) -> Option> { + fn cursor(&self) -> Option> { if let Some(ref state) = self.scan_state { state.args[state.cursor_idx].as_str() } else { @@ -177,7 +177,7 @@ impl Drop for HScanResult { impl Scanner for HScanResult { type Page = Map; - fn cursor(&self) -> Option> { + fn cursor(&self) -> Option> { if let Some(ref state) = self.scan_state { state.args[state.cursor_idx].as_str() } else { @@ -244,7 +244,7 @@ impl Drop for SScanResult { impl Scanner for SScanResult { type Page = Vec; - fn cursor(&self) -> Option> { + fn cursor(&self) -> Option> { if let Some(ref state) = self.scan_state { state.args[state.cursor_idx].as_str() } else { @@ -311,7 +311,7 @@ impl Drop for ZScanResult { impl Scanner for ZScanResult { type Page = Vec<(Value, f64)>; - fn cursor(&self) -> Option> { + fn cursor(&self) -> Option> { if let Some(ref state) = self.scan_state { state.args[state.cursor_idx].as_str() } else {