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. /// trait object.
pub trait SubTest { pub trait SubTest {
/// Name identifying this subtest. Typically the same as the test command. /// 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? /// Should the verifier be run on the function before running the test?
fn needs_verifier(&self) -> bool { fn needs_verifier(&self) -> bool {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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