@@ -67,29 +67,48 @@ impl Default for Version {
6767 major : env ! ( "CARGO_PKG_VERSION_MAJOR" ) . parse ( ) . unwrap ( ) ,
6868 minor : env ! ( "CARGO_PKG_VERSION_MINOR" ) . parse ( ) . unwrap ( ) ,
6969 patch : env ! ( "CARGO_PKG_VERSION_PATCH" ) . parse ( ) . unwrap ( ) ,
70- commit : compute_commit ( option_env ! ( "CI_COMMIT" ) ) ,
70+ commit : if cfg ! ( debug_assertions) {
71+ Some ( 0 )
72+ } else {
73+ compute_commit ( option_env ! ( "CI_COMMIT" ) )
74+ } ,
7175 feature_set,
7276 }
7377 }
7478}
7579
7680impl fmt:: Display for Version {
7781 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
78- write ! ( f, "{}.{}.{}" , self . major, self . minor, self . patch, )
82+ write ! (
83+ f,
84+ "{}.{}.{}{} {:?}" ,
85+ self . major,
86+ self . minor,
87+ self . patch,
88+ if self . commit == Some ( 0 ) { "d" } else { "" } ,
89+ self
90+ )
7991 }
8092}
8193
8294impl fmt:: Debug for Version {
8395 fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
8496 write ! (
8597 f,
86- "{}.{}.{} (src:{}; feat:{})" ,
98+ "{}.{}.{}{} (src:{}; feat:{})" ,
8799 self . major,
88100 self . minor,
89101 self . patch,
102+ if self . commit == Some ( 0 ) { "d" } else { "" } ,
90103 match self . commit {
91104 None => "devbuild" . to_string( ) ,
92- Some ( commit) => format!( "{:08x}" , commit) ,
105+ Some ( commit) => {
106+ if commit == 0 {
107+ "dbgbuild" . to_string( )
108+ } else {
109+ format!( "{:08x}" , commit)
110+ }
111+ }
93112 } ,
94113 self . feature_set,
95114 )
0 commit comments