Skip to content

Commit 5629404

Browse files
jeckersballisonkarlitskaya
authored andcommitted
Fix warnings for mismatched_lifetime_syntaxes lint
Rust 1.89 introduced this new lint[1], fix the handful of places where it comes up across the repo. [1] https://blog.rust-lang.org/2025/08/07/Rust-1.89.0/#mismatched-lifetime-syntaxes-lint Signed-off-by: John Eckersberg <[email protected]>
1 parent 29dca61 commit 5629404

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

crates/composefs/src/dumpfile_parse.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ pub enum Item<'p> {
131131

132132
/// Unescape a byte array according to the composefs dump file escaping format,
133133
/// limiting the maximum possible size.
134-
fn unescape_limited(s: &str, max: usize) -> Result<Cow<[u8]>> {
134+
fn unescape_limited(s: &str, max: usize) -> Result<Cow<'_, [u8]>> {
135135
// If there are no escapes, just return the input unchanged. However,
136136
// it must also be ASCII to maintain a 1-1 correspondence between byte
137137
// and character.
@@ -179,13 +179,13 @@ fn unescape_limited(s: &str, max: usize) -> Result<Cow<[u8]>> {
179179
}
180180

181181
/// Unescape a byte array according to the composefs dump file escaping format.
182-
fn unescape(s: &str) -> Result<Cow<[u8]>> {
182+
fn unescape(s: &str) -> Result<Cow<'_, [u8]>> {
183183
unescape_limited(s, usize::MAX)
184184
}
185185

186186
/// Unescape a string into a Rust `OsStr` which is really just an alias for a byte array,
187187
/// but we also impose a constraint that it can not have an embedded NUL byte.
188-
fn unescape_to_osstr(s: &str) -> Result<Cow<OsStr>> {
188+
fn unescape_to_osstr(s: &str) -> Result<Cow<'_, OsStr>> {
189189
let v = unescape(s)?;
190190
if v.contains(&0u8) {
191191
anyhow::bail!("Invalid embedded NUL");
@@ -201,7 +201,7 @@ fn unescape_to_osstr(s: &str) -> Result<Cow<OsStr>> {
201201
/// with a few constraints:
202202
/// - Cannot contain an embedded NUL
203203
/// - Cannot be empty, or longer than PATH_MAX
204-
fn unescape_to_path(s: &str) -> Result<Cow<Path>> {
204+
fn unescape_to_path(s: &str) -> Result<Cow<'_, Path>> {
205205
let v = unescape_to_osstr(s).and_then(|v| {
206206
if v.is_empty() {
207207
anyhow::bail!("Invalid empty path");
@@ -224,7 +224,7 @@ fn unescape_to_path(s: &str) -> Result<Cow<Path>> {
224224
/// which in particular removes `.` and extra `//`.
225225
///
226226
/// We also deny uplinks `..` and empty paths.
227-
fn unescape_to_path_canonical(s: &str) -> Result<Cow<Path>> {
227+
fn unescape_to_path_canonical(s: &str) -> Result<Cow<'_, Path>> {
228228
let p = unescape_to_path(s)?;
229229
let mut components = p.components();
230230
let mut r = std::path::PathBuf::new();

crates/composefs/src/erofs/reader.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ impl<'img> Image<'img> {
295295
}
296296
}
297297

298-
pub fn inode(&self, id: u64) -> InodeType {
298+
pub fn inode(&self, id: u64) -> InodeType<'_> {
299299
let inode_data = &self.inodes[id as usize * 32..];
300300
if inode_data[0] & 1 != 0 {
301301
let header = ExtendedInodeHeader::ref_from_bytes(&inode_data[..64]).unwrap();
@@ -340,7 +340,7 @@ impl<'img> Image<'img> {
340340
DirectoryBlock::ref_from_bytes(self.block(id)).unwrap()
341341
}
342342

343-
pub fn root(&self) -> InodeType {
343+
pub fn root(&self) -> InodeType<'_> {
344344
self.inode(self.sb.root_nid.get() as u64)
345345
}
346346
}
@@ -358,7 +358,7 @@ impl InodeXAttrs {
358358
.0
359359
}
360360

361-
pub fn local(&self) -> XAttrIter {
361+
pub fn local(&self) -> XAttrIter<'_> {
362362
XAttrIter {
363363
data: &self.data[self.header.shared_count as usize * 4..],
364364
}
@@ -414,7 +414,7 @@ impl DirectoryBlock {
414414
offset as usize / 12
415415
}
416416

417-
pub fn entries(&self) -> DirectoryEntries {
417+
pub fn entries(&self) -> DirectoryEntries<'_> {
418418
DirectoryEntries {
419419
block: self,
420420
length: self.n_entries(),

crates/composefs/src/mount.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ impl FsHandle {
3030
}
3131

3232
impl AsFd for FsHandle {
33-
fn as_fd(&self) -> BorrowedFd {
33+
fn as_fd(&self) -> BorrowedFd<'_> {
3434
self.fd.as_fd()
3535
}
3636
}

crates/composefs/src/mountcompat.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ mod tmpmount {
151151
}
152152

153153
impl AsFd for TmpMount {
154-
fn as_fd(&self) -> BorrowedFd {
154+
fn as_fd(&self) -> BorrowedFd<'_> {
155155
self.fd.as_fd()
156156
}
157157
}

0 commit comments

Comments
 (0)