Skip to content

Commit cf92f4c

Browse files
authored
Rollup merge of #125438 - tbu-:pr_rm_to_string_lossy, r=jieyouxu
Remove unneeded string conversion
2 parents eb1b9b0 + 3ac1a80 commit cf92f4c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

compiler/rustc_codegen_ssa/src/back/link.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -786,12 +786,12 @@ fn link_natively(
786786
if matches!(flavor, LinkerFlavor::Gnu(Cc::Yes, _))
787787
&& unknown_arg_regex.is_match(&out)
788788
&& out.contains("-no-pie")
789-
&& cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie")
789+
&& cmd.get_args().iter().any(|e| e == "-no-pie")
790790
{
791791
info!("linker output: {:?}", out);
792792
warn!("Linker does not support -no-pie command line option. Retrying without.");
793793
for arg in cmd.take_args() {
794-
if arg.to_string_lossy() != "-no-pie" {
794+
if arg != "-no-pie" {
795795
cmd.arg(arg);
796796
}
797797
}
@@ -825,7 +825,7 @@ fn link_natively(
825825
if matches!(flavor, LinkerFlavor::Gnu(Cc::Yes, _))
826826
&& unknown_arg_regex.is_match(&out)
827827
&& (out.contains("-static-pie") || out.contains("--no-dynamic-linker"))
828-
&& cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie")
828+
&& cmd.get_args().iter().any(|e| e == "-static-pie")
829829
{
830830
info!("linker output: {:?}", out);
831831
warn!(
@@ -864,7 +864,7 @@ fn link_natively(
864864
assert!(pre_objects_static.is_empty() || !pre_objects_static_pie.is_empty());
865865
assert!(post_objects_static.is_empty() || !post_objects_static_pie.is_empty());
866866
for arg in cmd.take_args() {
867-
if arg.to_string_lossy() == "-static-pie" {
867+
if arg == "-static-pie" {
868868
// Replace the output kind.
869869
cmd.arg("-static");
870870
} else if pre_objects_static_pie.contains(&arg) {

src/tools/tidy/src/style.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ pub fn is_in(full_path: &Path, parent_folder_to_find: &str, folder_to_find: &str
243243
if parent.file_name().map_or_else(
244244
|| false,
245245
|f| {
246-
f.to_string_lossy() == folder_to_find
246+
f == folder_to_find
247247
&& parent
248248
.parent()
249249
.and_then(|f| f.file_name())

0 commit comments

Comments
 (0)