Patchwork D10743: rust: Fix "panic message is not a string literal" warnings

login
register
mail settings
Submitter phabricator
Date May 19, 2021, 1:22 p.m.
Message ID <differential-rev-PHID-DREV-wc742abrt3uprx2g5mi3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49063/
State Superseded
Headers show

Comments

phabricator - May 19, 2021, 1:22 p.m.
SimonSapin created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  These deprecation warnings would not become errors until we actively port
  crates to the (not yet released) Rust 2021 edition, but fixing them anyway
  reduces console output noise.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10743

AFFECTED FILES
  rust/hg-core/tests/test_missing_ancestors.rs

CHANGE DETAILS




To: SimonSapin, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/rust/hg-core/tests/test_missing_ancestors.rs b/rust/hg-core/tests/test_missing_ancestors.rs
--- a/rust/hg-core/tests/test_missing_ancestors.rs
+++ b/rust/hg-core/tests/test_missing_ancestors.rs
@@ -156,7 +156,7 @@ 
         if left == right {
             return;
         }
-        panic!(format!(
+        panic!(
             "Equality assertion failed (left != right)
                 left={:?}
                 right={:?}
@@ -171,7 +171,7 @@ 
             self.bases,
             self.history,
             self.random_seed,
-        ));
+        );
     }
 }
 
@@ -231,7 +231,7 @@ 
         .map(|n| n.trim().parse().expect(err_msg))
         .collect();
     if params.len() != 3 {
-        panic!(err_msg);
+        panic!("{}", err_msg);
     }
     (params[0], params[1], params[2])
 }