Repository navigation
refactor: rename lifetimes to be descriptive (#735) - #758
Conversation
|
looking for all the feedbacks to work @alejandro-vaz |
alejandro-vaz
left a comment
There was a problem hiding this comment.
honestly I'd just rename all of them to 'valid
like it doesn't give the developer any information that the lifetime is of the slice, for example. that's just self-explanatory
the information the lifetime conveys in these cases is for how long is it valid
this is not the case in all rust, but it is in our codebase
|
ok i will do according to the feedback |
37b383e to
886c8a7
Compare
|
if this is the required update so i can update the other files also acc to the above naming convention |
|
yeah it is that you also have to run rustfmt |
|
OK sir I will that I will try to complete this in the morning |
|
l Have worked on the above feedback I've pushed a new update that addresses all of your points: Lifetime Renaming: I have globally renamed all single-character lifetimes across the codebase to 'valid as you suggested, as it perfectly conveys how long the references remain valid without needing arbitrary context-specific names. Removed Doc Comments: I have deleted all the doc comments you pointed out in tests/main.rs, fuzz_targets/main.rs, and bench.rs since they aren't necessary right now. Fixed Failing Checks: The compiler checks were failing due to a lifetime name collision where DropGuard in drain.rs ended up with two identical generic parameters ('valid, 'valid). I fixed this by separating them into 'guard and 'valid. Formatting: I've run cargo fmt globally across the codebase. |
|
you have to run nightly rustfmt, otherwise CI fails make sure you have the latest nightly as well |
|
Ok @alejandro-vaz i will do it today i was busy with interview stuff |
|
👍 no worries |
|
alright I'm back with this you have to rebase to the you there?? |
|
@Ankit-cs use +nightly or maybe register a hook |
Replaces custom lifetimes (e.g., 'slice, 'data, 'cell) in benches, fuzz targets, and tests with the standard 'valid lifetime to ensure codebase consistency as per maintainer feedback.
c8474f4 to
35414d3
Compare
|
@alejandro-vaz I have rebased onto latest v2 and formatted the entire codebase with the latest cargo +nightly fmt --all. All checks should pass cleanly now! |
|
thanks @Ankit-cs |
Description
This PR resolves issue #735 by renaming all single-character generic lifetimes (
'a) across the codebase to be more descriptive and easier to relate to their context.Changes Made
tests/main.rs: Renamed'ato'cellforCountDropandDropCounter, as it explicitly represents the lifetime of the referencedCell.benches/bench.rs: Renamed'ato'slicewithin theVectortrait to clarify it represents the lifetime of the referenced slice (&[T]).fuzz/fuzz_targets/main.rs: Renamed'ato'datato clearly denote the lifetime of the unstructured fuzzing data buffer used by theArbitrarytrait.Closes #735