Skip to content

Commit 3ac1a80

Browse files
committed
Remove unneeded string conversion
1 parent f0038a7 commit 3ac1a80

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
}
@@ -804,7 +804,7 @@ fn link_natively(
804804
if matches!(flavor, LinkerFlavor::Gnu(Cc::Yes, _))
805805
&& unknown_arg_regex.is_match(&out)
806806
&& (out.contains("-static-pie") || out.contains("--no-dynamic-linker"))
807-
&& cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie")
807+
&& cmd.get_args().iter().any(|e| e == "-static-pie")
808808
{
809809
info!("linker output: {:?}", out);
810810
warn!(
@@ -843,7 +843,7 @@ fn link_natively(
843843
assert!(pre_objects_static.is_empty() || !pre_objects_static_pie.is_empty());
844844
assert!(post_objects_static.is_empty() || !post_objects_static_pie.is_empty());
845845
for arg in cmd.take_args() {
846-
if arg.to_string_lossy() == "-static-pie" {
846+
if arg == "-static-pie" {
847847
// Replace the output kind.
848848
cmd.arg("-static");
849849
} 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)