-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: tison <[email protected]>
- Loading branch information
Showing
6 changed files
with
118 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[toolchain] | ||
channel = "stable" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -64,6 +64,8 @@ pub struct Metadata { | |
pub authors: Cow<'static, str>, | ||
/// The URL of the crate's website | ||
pub homepage: Cow<'static, str>, | ||
/// The support information | ||
pub supports: Cow<'static, str>, | ||
} | ||
|
||
/// Initialize [`Metadata`] | ||
|
@@ -75,6 +77,7 @@ macro_rules! metadata { | |
name: env!("CARGO_PKG_NAME").into(), | ||
authors: env!("CARGO_PKG_AUTHORS").replace(":", ", ").into(), | ||
homepage: env!("CARGO_PKG_HOMEPAGE").into(), | ||
supports: Default::default(), | ||
} | ||
}}; | ||
} | ||
|
@@ -98,7 +101,8 @@ macro_rules! metadata { | |
/// name: env!("CARGO_PKG_NAME").into(), | ||
/// version: env!("CARGO_PKG_VERSION").into(), | ||
/// authors: "My Company Support <[email protected]>".into(), | ||
/// homepage: "support.mycompany.com".into(), | ||
/// homepage: "www.mycompany.com".into(), | ||
/// supports: "- Open a support request by email to [email protected]".into(), | ||
/// }); | ||
/// ``` | ||
#[macro_export] | ||
|
@@ -180,8 +184,13 @@ fn write_msg<P: AsRef<Path>>( | |
file_path: Option<P>, | ||
meta: &Metadata, | ||
) -> IoResult<()> { | ||
let (_version, name, authors, homepage) = | ||
(&meta.version, &meta.name, &meta.authors, &meta.homepage); | ||
let Metadata { | ||
name, | ||
authors, | ||
homepage, | ||
supports, | ||
.. | ||
} = meta; | ||
|
||
writeln!(buffer, "Well, this is embarrassing.\n")?; | ||
writeln!( | ||
|
@@ -207,6 +216,9 @@ fn write_msg<P: AsRef<Path>>( | |
if !authors.is_empty() { | ||
writeln!(buffer, "- Authors: {authors}")?; | ||
} | ||
if !supports.is_empty() { | ||
writeln!(buffer, "\nTo submit the crash report:\n\n{supports}")?; | ||
} | ||
writeln!( | ||
buffer, | ||
"\nWe take privacy seriously, and do not perform any \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,8 @@ fn main() { | |
name: env!("CARGO_PKG_NAME").into(), | ||
version: env!("CARGO_PKG_VERSION").into(), | ||
authors: "My Company Support <[email protected]".into(), | ||
homepage: "support.mycompany.com".into(), | ||
homepage: "www.mycompany.com".into(), | ||
supports: "- Open a support request by email to [email protected]".into() | ||
}); | ||
|
||
println!("A normal log message"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,13 @@ custom-panic-test had a problem and crashed. To help us diagnose the problem you | |
We have generated a report file at \"[..].toml\". Submit an issue or email with the subject of \"custom-panic-test Crash Report\" and include the report as an attachment. | ||
- Homepage: support.mycompany.com | ||
- Homepage: www.mycompany.com | ||
- Authors: My Company Support <[email protected] | ||
To submit the crash report: | ||
- Open a support request by email to [email protected] | ||
We take privacy seriously, and do not perform any automated error collection. In order to improve the software, we rely on people to submit reports. | ||
Thank you kindly! | ||
|
@@ -29,7 +33,8 @@ fn debug() { | |
.assert() | ||
.stderr_matches( | ||
"\ | ||
thread 'main' panicked at 'OMG EVERYTHING IS ON FIRE!!!', tests/custom-panic/src/main.rs:12:3 | ||
thread 'main' panicked at tests/custom-panic/src/main.rs:13:5: | ||
OMG EVERYTHING IS ON FIRE!!! | ||
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace | ||
", | ||
) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters