11use crate :: commit_message:: message_build:: MessageBuilder ;
22use crate :: config:: Config ;
3- use anyhow:: Result ;
43
54fn message_with_config ( config : Config ) -> String {
65 let mut builder = MessageBuilder :: new ( config) ;
@@ -13,11 +12,11 @@ fn message_with_config(config: Config) -> String {
1312}
1413
1514#[ test]
16- fn message_builder_config_test ( ) -> Result < ( ) > {
15+ fn message_builder_config_test ( ) {
1716 let mut config = Config {
18- scope_prefix : "(" . to_string ( ) ,
19- scope_suffix : ")" . to_string ( ) ,
20- subject_separator : ": " . to_string ( ) ,
17+ scope_prefix : "(" . to_owned ( ) ,
18+ scope_suffix : ")" . to_owned ( ) ,
19+ subject_separator : ": " . to_owned ( ) ,
2120 type_prefix : None ,
2221 type_suffix : None ,
2322 } ;
@@ -27,36 +26,35 @@ fn message_builder_config_test() -> Result<()> {
2726 "feat(test): description\n \n body\n \n footer"
2827 ) ;
2928
30- config. type_prefix = Some ( "[" . to_string ( ) ) ;
31- config. type_suffix = Some ( "]" . to_string ( ) ) ;
29+ config. type_prefix = Some ( "[" . to_owned ( ) ) ;
30+ config. type_suffix = Some ( "]" . to_owned ( ) ) ;
3231
3332 assert_eq ! (
3433 message_with_config( config. clone( ) ) ,
3534 "[feat](test): description\n \n body\n \n footer"
3635 ) ;
37- config. subject_separator = " " . to_string ( ) ;
36+ config. subject_separator = " " . to_owned ( ) ;
3837
3938 assert_eq ! (
4039 message_with_config( config. clone( ) ) ,
4140 "[feat](test) description\n \n body\n \n footer"
4241 ) ;
4342
44- config. scope_prefix = "" . to_string ( ) ;
45- config. scope_suffix = "" . to_string ( ) ;
43+ config. scope_prefix = "" . to_owned ( ) ;
44+ config. scope_suffix = "" . to_owned ( ) ;
4645
4746 assert_eq ! (
48- message_with_config( config. clone ( ) ) ,
47+ message_with_config( config) ,
4948 "[feat]test description\n \n body\n \n footer"
5049 ) ;
51- Ok ( ( ) )
5250}
5351
5452#[ test]
55- fn message_builder_test ( ) -> Result < ( ) > {
53+ fn message_builder_test ( ) {
5654 let config = Config {
57- scope_prefix : "(" . to_string ( ) ,
58- scope_suffix : ")" . to_string ( ) ,
59- subject_separator : ": " . to_string ( ) ,
55+ scope_prefix : "(" . to_owned ( ) ,
56+ scope_suffix : ")" . to_owned ( ) ,
57+ subject_separator : ": " . to_owned ( ) ,
6058 type_prefix : None ,
6159 type_suffix : None ,
6260 } ;
@@ -76,5 +74,4 @@ fn message_builder_test() -> Result<()> {
7674
7775 builder. set_footer ( "footer" ) ;
7876 assert_eq ! ( builder. message, "feat(test): description\n \n body\n \n footer" ) ;
79- Ok ( ( ) )
8077}
0 commit comments