Use `into_owned` over `to_string` for `Cow<str>` (#39024)

This removes unnecessary allocations when the `Cow` is already owned


Release Notes:

- N/A *or* Added/Fixed/Improved ...
72948e14eeLukas Wirth committed on 9/27/2025, 2:50:10 PM· committed by GitHubparenta063a70
64 files changedLine totals unavailable