@@ -63,6 +63,8 @@ pub struct Metadata {
6363 pub authors : Cow < ' static , str > ,
6464 /// The URL of the crate's website
6565 pub homepage : Cow < ' static , str > ,
66+ /// The URL of the crate's repository
67+ pub repository : Cow < ' static , str > ,
6668}
6769
6870/// `human-panic` initialisation macro
@@ -119,6 +121,7 @@ macro_rules! setup_panic {
119121 name: env!( "CARGO_PKG_NAME" ) . into( ) ,
120122 authors: env!( "CARGO_PKG_AUTHORS" ) . replace( ":" , ", " ) . into( ) ,
121123 homepage: env!( "CARGO_PKG_HOMEPAGE" ) . into( ) ,
124+ repository: env!( "CARGO_PKG_REPOSITORY" ) . into( ) ,
122125 } ;
123126
124127 panic:: set_hook( Box :: new( move |info: & PanicInfo | {
@@ -137,8 +140,8 @@ pub fn print_msg<P: AsRef<Path>>(
137140 file_path : Option < P > ,
138141 meta : & Metadata ,
139142) -> IoResult < ( ) > {
140- let ( _version, name, authors, homepage) =
141- ( & meta. version , & meta. name , & meta. authors , & meta. homepage ) ;
143+ let ( _version, name, authors, homepage, repository ) =
144+ ( & meta. version , & meta. name , & meta. authors , & meta. homepage , & meta . repository ) ;
142145
143146 let stderr = BufferWriter :: stderr ( ColorChoice :: Auto ) ;
144147 let mut buffer = stderr. buffer ( ) ;
@@ -166,6 +169,9 @@ pub fn print_msg<P: AsRef<Path>>(
166169 if !homepage. is_empty ( ) {
167170 writeln ! ( & mut buffer, "- Homepage: {}" , homepage) ?;
168171 }
172+ if !repository. is_empty ( ) && repository != homepage {
173+ writeln ! ( & mut buffer, "- Repository: {}" , repository) ?;
174+ }
169175 if !authors. is_empty ( ) {
170176 writeln ! ( & mut buffer, "- Authors: {}" , authors) ?;
171177 }
0 commit comments