Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: eliminating indexing_slicing #6214

Merged
merged 14 commits into from
Nov 18, 2024
Merged

Conversation

link2xt
Copy link
Collaborator

@link2xt link2xt commented Nov 16, 2024

Removing all indexing_slicing from the core, so next time we get something like #6221 we can immediately blame dependencies. See commit messages for details.

clippy::string_slice is a separate issue #6224

@link2xt link2xt changed the title refactor: remove slicing from is_file_in_use refactor: reducing the usage of indexing_slicing Nov 18, 2024
There is a change in behavior for the case
when name is the same as the suffix
(`name_len` == `namespc_len`),
but normally `files_in_use` should not contain empty filenames.
@link2xt link2xt force-pushed the link2xt/is_file_in_use-no-slicing branch 3 times, most recently from 8b8e175 to 37c2348 Compare November 18, 2024 11:58
@link2xt link2xt force-pushed the link2xt/is_file_in_use-no-slicing branch 8 times, most recently from 1d0b3c0 to 52e0526 Compare November 18, 2024 13:33
@link2xt link2xt force-pushed the link2xt/is_file_in_use-no-slicing branch from 52e0526 to a264cbf Compare November 18, 2024 14:42
@link2xt
Copy link
Collaborator Author

link2xt commented Nov 18, 2024

When I remove this:

#[allow(clippy::indexing_slicing)]

Clippy still does not catch this slicing:

&format!("{}-auth-required", &step[..2]),

This should be reduced to a minimal case and reported to https://github.com/rust-lang/rust-clippy

EDIT: reported here: rust-lang/rust-clippy#13703

EDIT2: this is handled by string_slice, we should enable #![cfg_attr(not(test), warn(clippy::string_slice))] as well.
Moved to #6224

@link2xt link2xt force-pushed the link2xt/is_file_in_use-no-slicing branch from 5765b0c to 0cdd9b4 Compare November 18, 2024 18:54
@link2xt link2xt marked this pull request as draft November 18, 2024 19:12
@link2xt
Copy link
Collaborator Author

link2xt commented Nov 18, 2024

Only 31 indexing_slicing functions left, will mark as non-draft once they are fixed as well.

@link2xt link2xt marked this pull request as ready for review November 18, 2024 20:11
It is impossible to allow this in the new code now.
@link2xt link2xt force-pushed the link2xt/is_file_in_use-no-slicing branch from 76d5f95 to c5c5e14 Compare November 18, 2024 20:14
@link2xt link2xt changed the title refactor: reducing the usage of indexing_slicing refactor: eliminating indexing_slicing Nov 18, 2024
@link2xt link2xt merged commit 3235c8b into main Nov 18, 2024
38 checks passed
@link2xt link2xt deleted the link2xt/is_file_in_use-no-slicing branch November 18, 2024 21:58
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.

2 participants