Skip to content

Commit

Permalink
Rollup merge of rust-lang#125438 - tbu-:pr_rm_to_string_lossy, r=jiey…
Browse files Browse the repository at this point in the history
…ouxu

Remove unneeded string conversion
  • Loading branch information
matthiaskrgr authored May 23, 2024
2 parents eb1b9b0 + 3ac1a80 commit cf92f4c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions compiler/rustc_codegen_ssa/src/back/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -786,12 +786,12 @@ fn link_natively(
if matches!(flavor, LinkerFlavor::Gnu(Cc::Yes, _))
&& unknown_arg_regex.is_match(&out)
&& out.contains("-no-pie")
&& cmd.get_args().iter().any(|e| e.to_string_lossy() == "-no-pie")
&& cmd.get_args().iter().any(|e| e == "-no-pie")
{
info!("linker output: {:?}", out);
warn!("Linker does not support -no-pie command line option. Retrying without.");
for arg in cmd.take_args() {
if arg.to_string_lossy() != "-no-pie" {
if arg != "-no-pie" {
cmd.arg(arg);
}
}
Expand Down Expand Up @@ -825,7 +825,7 @@ fn link_natively(
if matches!(flavor, LinkerFlavor::Gnu(Cc::Yes, _))
&& unknown_arg_regex.is_match(&out)
&& (out.contains("-static-pie") || out.contains("--no-dynamic-linker"))
&& cmd.get_args().iter().any(|e| e.to_string_lossy() == "-static-pie")
&& cmd.get_args().iter().any(|e| e == "-static-pie")
{
info!("linker output: {:?}", out);
warn!(
Expand Down Expand Up @@ -864,7 +864,7 @@ fn link_natively(
assert!(pre_objects_static.is_empty() || !pre_objects_static_pie.is_empty());
assert!(post_objects_static.is_empty() || !post_objects_static_pie.is_empty());
for arg in cmd.take_args() {
if arg.to_string_lossy() == "-static-pie" {
if arg == "-static-pie" {
// Replace the output kind.
cmd.arg("-static");
} else if pre_objects_static_pie.contains(&arg) {
Expand Down
2 changes: 1 addition & 1 deletion src/tools/tidy/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ pub fn is_in(full_path: &Path, parent_folder_to_find: &str, folder_to_find: &str
if parent.file_name().map_or_else(
|| false,
|f| {
f.to_string_lossy() == folder_to_find
f == folder_to_find
&& parent
.parent()
.and_then(|f| f.file_name())
Expand Down

0 comments on commit cf92f4c

Please sign in to comment.