Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strip a single leading tab when rendering dataflow diffs #76775

Merged
merged 1 commit into from
Sep 16, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/rustc_mir/src/dataflow/framework/graphviz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ where
return String::new();
}

let re = Regex::new("\u{001f}([+-])").unwrap();
let re = Regex::new("\t?\u{001f}([+-])").unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using OnceCell here for the Regex to avoid repeatedly compiling ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is debug-only code so it doesn't matter too much in practice, and I'd guess this regex is so small it compiles nearly instantaneously. I wouldn't object to a PR adding a OnceCell if it didn't add too much noise to this code.


let raw_diff = format!("{:#?}", DebugDiffWithAdapter { new, old, ctxt });

Expand Down