Skip to content

dirname: use Cow::Borrowed to avoid unnecessary heap allocations#10294

Merged
ChrisDryden merged 1 commit into
uutils:mainfrom
sylvestre:dirname
Jan 17, 2026
Merged

dirname: use Cow::Borrowed to avoid unnecessary heap allocations#10294
ChrisDryden merged 1 commit into
uutils:mainfrom
sylvestre:dirname

Conversation

@sylvestre

Copy link
Copy Markdown
Contributor
  • remove useless comments

@github-actions

Copy link
Copy Markdown

GNU testsuite comparison:

GNU test failed: tests/tail/follow-name. tests/tail/follow-name is passing on 'main'. Maybe you have to rebase?

@ChrisDryden

Copy link
Copy Markdown
Collaborator

Did a search across the code base for other instances of this pattern and couldn't find any others, you'd think that slicing input data then calling .to_vec() in a Cow would be a Clippy rule

@ChrisDryden
ChrisDryden merged commit f01d1e8 into uutils:main Jan 17, 2026
156 of 157 checks passed
@sylvestre
sylvestre deleted the dirname branch January 17, 2026 20:06
@sylvestre

Copy link
Copy Markdown
Contributor Author

I did not but I can nerd snip @samueltardieu

@ChrisDryden

ChrisDryden commented Jan 17, 2026

Copy link
Copy Markdown
Collaborator

I tried to look in clippy for this Cow stuff and for embedded cfg blocks #10296, couldn't even find suggestions in the issues queue

@samueltardieu

Copy link
Copy Markdown
Contributor

Did a search across the code base for other instances of this pattern and couldn't find any others, you'd think that slicing input data then calling .to_vec() in a Cow would be a Clippy rule

Well, that may be required if you need the Cow to live longer than the slice.

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