Use &'static str rather than Cow<str> for pass names.

This commit is contained in:
Dan Gohman
2018-06-04 16:17:02 -07:00
parent 6c003d68cd
commit ae8fc69406
14 changed files with 27 additions and 27 deletions

View File

@@ -45,7 +45,7 @@ impl<'a> Context<'a> {
/// trait object.
pub trait SubTest {
/// Name identifying this subtest. Typically the same as the test command.
fn name(&self) -> Cow<str>;
fn name(&self) -> &'static str;
/// Should the verifier be run on the function before running the test?
fn needs_verifier(&self) -> bool {

View File

@@ -96,8 +96,8 @@ impl binemit::CodeSink for TextSink {
}
impl SubTest for TestBinEmit {
fn name(&self) -> Cow<str> {
Cow::from("binemit")
fn name(&self) -> &'static str {
"binemit"
}
fn is_mutating(&self) -> bool {

View File

@@ -23,8 +23,8 @@ pub fn subtest(parsed: &TestCommand) -> STResult<Box<SubTest>> {
}
impl SubTest for TestCat {
fn name(&self) -> Cow<str> {
Cow::from("cat")
fn name(&self) -> &'static str {
"cat"
}
fn needs_verifier(&self) -> bool {

View File

@@ -22,8 +22,8 @@ pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
}
impl SubTest for TestCompile {
fn name(&self) -> Cow<str> {
Cow::from("compile")
fn name(&self) -> &'static str {
"compile"
}
fn is_mutating(&self) -> bool {

View File

@@ -25,8 +25,8 @@ pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
}
impl SubTest for TestDCE {
fn name(&self) -> Cow<str> {
Cow::from("dce")
fn name(&self) -> &'static str {
"dce"
}
fn is_mutating(&self) -> bool {

View File

@@ -36,8 +36,8 @@ pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
}
impl SubTest for TestDomtree {
fn name(&self) -> Cow<str> {
Cow::from("domtree")
fn name(&self) -> &'static str {
"domtree"
}
// Extract our own dominator tree from

View File

@@ -23,8 +23,8 @@ pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
}
impl SubTest for TestLegalizer {
fn name(&self) -> Cow<str> {
Cow::from("legalizer")
fn name(&self) -> &'static str {
"legalizer"
}
fn is_mutating(&self) -> bool {

View File

@@ -25,8 +25,8 @@ pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
}
impl SubTest for TestLICM {
fn name(&self) -> Cow<str> {
Cow::from("licm")
fn name(&self) -> &'static str {
"licm"
}
fn is_mutating(&self) -> bool {

View File

@@ -22,8 +22,8 @@ pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
}
impl SubTest for TestPostopt {
fn name(&self) -> Cow<str> {
Cow::from("postopt")
fn name(&self) -> &'static str {
"postopt"
}
fn is_mutating(&self) -> bool {

View File

@@ -22,8 +22,8 @@ pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
}
impl SubTest for TestPreopt {
fn name(&self) -> Cow<str> {
Cow::from("preopt")
fn name(&self) -> &'static str {
"preopt"
}
fn is_mutating(&self) -> bool {

View File

@@ -23,8 +23,8 @@ pub fn subtest(parsed: &TestCommand) -> STResult<Box<SubTest>> {
}
impl SubTest for TestPrintCfg {
fn name(&self) -> Cow<str> {
Cow::from("print-cfg")
fn name(&self) -> &'static str {
"print-cfg"
}
fn needs_verifier(&self) -> bool {

View File

@@ -25,8 +25,8 @@ pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
}
impl SubTest for TestRegalloc {
fn name(&self) -> Cow<str> {
Cow::from("regalloc")
fn name(&self) -> &'static str {
"regalloc"
}
fn is_mutating(&self) -> bool {

View File

@@ -25,8 +25,8 @@ pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
}
impl SubTest for TestSimpleGVN {
fn name(&self) -> Cow<str> {
Cow::from("simple-gvn")
fn name(&self) -> &'static str {
"simple-gvn"
}
fn is_mutating(&self) -> bool {

View File

@@ -28,8 +28,8 @@ pub fn subtest(parsed: &TestCommand) -> Result<Box<SubTest>> {
}
impl SubTest for TestVerifier {
fn name(&self) -> Cow<str> {
Cow::from("verifier")
fn name(&self) -> &'static str {
"verifier"
}
fn needs_verifier(&self) -> bool {