Update SubstrateCli to return String (#6550)

* Update SubstrateCli to return String

* Add default implementation for executable_name()

* Use display instead of PathBuf

* Get file_name in default impl of executable_name

* Remove String::from and use .into()

* Use default impl for executable_name()

* Use .as_str() and remove useless .to_string()

* Update only sp-io when running companion build

* Remove unneeded update of sp-io in CI

Co-authored-by: Cecile Tonglet <cecile@parity.io>
This commit is contained in:
pscott
2020-07-02 13:34:56 +02:00
committed by GitHub
parent 7b0028d75a
commit 540ae1c161
10 changed files with 65 additions and 62 deletions
@@ -52,11 +52,12 @@ enum OnPanic {
///
/// The `bug_url` parameter is an invitation for users to visit that URL to submit a bug report
/// in the case where a panic happens.
pub fn set(bug_url: &'static str, version: &str) {
pub fn set(bug_url: &str, version: &str) {
panic::set_hook(Box::new({
let version = version.to_string();
let bug_url = bug_url.to_string();
move |c| {
panic_hook(c, bug_url, &version)
panic_hook(c, &bug_url, &version)
}
}));
}
@@ -130,7 +131,7 @@ impl Drop for AbortGuard {
}
/// Function being called when a panic happens.
fn panic_hook(info: &PanicInfo, report_url: &'static str, version: &str) {
fn panic_hook(info: &PanicInfo, report_url: &str, version: &str) {
let location = info.location();
let file = location.as_ref().map(|l| l.file()).unwrap_or("<unknown>");
let line = location.as_ref().map(|l| l.line()).unwrap_or(0);