@@ -16,10 +16,7 @@ use super::sql::parse_req;
1616
1717pub fn cli ( ) -> clap:: Command {
1818 clap:: Command :: new ( "call" )
19- . about ( format ! (
20- "Invokes a reducer function in a database. {}" ,
21- UNSTABLE_WARNING
22- ) )
19+ . about ( format ! ( "Invokes a reducer function in a database. {UNSTABLE_WARNING}" ) )
2320 . arg (
2421 Arg :: new ( "database" )
2522 . required ( true )
@@ -38,7 +35,7 @@ pub fn cli() -> clap::Command {
3835}
3936
4037pub async fn exec ( config : Config , args : & ArgMatches ) -> Result < ( ) , Error > {
41- eprintln ! ( "{}\n " , UNSTABLE_WARNING ) ;
38+ eprintln ! ( "{UNSTABLE_WARNING }\n " ) ;
4239 let reducer_name = args. get_one :: < String > ( "reducer_name" ) . unwrap ( ) ;
4340 let arguments = args. get_many :: < String > ( "arguments" ) ;
4441
@@ -60,7 +57,7 @@ pub async fn exec(config: Config, args: &ArgMatches) -> Result<(), Error> {
6057 . zip ( & * reducer_def. params . elements )
6158 . map ( |( argument, element) | match & element. algebraic_type {
6259 AlgebraicType :: String if !argument. starts_with ( '\"' ) || !argument. ends_with ( '\"' ) => {
63- format ! ( "\" {}\" " , argument )
60+ format ! ( "\" {argument }\" " )
6461 }
6562 _ => argument. to_string ( ) ,
6663 } ) ;
@@ -74,7 +71,7 @@ pub async fn exec(config: Config, args: &ArgMatches) -> Result<(), Error> {
7471 bail ! ( e) ;
7572 } ;
7673
77- let error = Err ( e) . context ( format ! ( "Response text: {}" , response_text ) ) ;
74+ let error = Err ( e) . context ( format ! ( "Response text: {response_text}" ) ) ;
7875
7976 let error_msg = if response_text. starts_with ( "no such reducer" ) {
8077 no_such_reducer ( & database_identity, database, reducer_name, & module_def)
@@ -106,8 +103,7 @@ fn invalid_arguments(
106103 if let Some ( ( actual, expected) ) = find_actual_expected ( text) . filter ( |( a, e) | a != e) {
107104 write ! (
108105 error,
109- "\n \n {} parameters were expected, but {} were provided." ,
110- expected, actual
106+ "\n \n {expected} parameters were expected, but {actual} were provided."
111107 )
112108 . unwrap ( ) ;
113109 }
@@ -170,10 +166,8 @@ impl std::fmt::Display for ReducerSignature<'_> {
170166
171167/// Returns an error message for when `reducer` does not exist in `db`.
172168fn no_such_reducer ( database_identity : & Identity , db : & str , reducer : & str , module_def : & ModuleDef ) -> String {
173- let mut error = format ! (
174- "No such reducer `{}` for database `{}` resolving to identity `{}`." ,
175- reducer, db, database_identity
176- ) ;
169+ let mut error =
170+ format ! ( "No such reducer `{reducer}` for database `{db}` resolving to identity `{database_identity}`." ) ;
177171
178172 add_reducer_ctx_to_err ( & mut error, module_def, reducer) ;
179173
@@ -192,7 +186,7 @@ fn add_reducer_ctx_to_err(error: &mut String, module_def: &ModuleDef, reducer_na
192186 . collect :: < Vec < _ > > ( ) ;
193187
194188 if let Some ( best) = find_best_match_for_name ( & reducers, reducer_name, None ) {
195- write ! ( error, "\n \n A reducer with a similar name exists: `{}`" , best ) . unwrap ( ) ;
189+ write ! ( error, "\n \n A reducer with a similar name exists: `{best }`" ) . unwrap ( ) ;
196190 } else if reducers. is_empty ( ) {
197191 write ! ( error, "\n \n The database has no reducers." ) . unwrap ( ) ;
198192 } else {
@@ -207,13 +201,13 @@ fn add_reducer_ctx_to_err(error: &mut String, module_def: &ModuleDef, reducer_na
207201 // List them.
208202 write ! ( error, "\n \n Here are some existing reducers:" ) . unwrap ( ) ;
209203 for candidate in reducers {
210- write ! ( error, "\n - {}" , candidate ) . unwrap ( ) ;
204+ write ! ( error, "\n - {candidate}" ) . unwrap ( ) ;
211205 }
212206
213207 // When some where not listed, note that are more.
214208 if too_many_to_show {
215209 let plural = if diff == 1 { "" } else { "s" } ;
216- write ! ( error, "\n ... ({} reducer{} not shown)" , diff , plural ) . unwrap ( ) ;
210+ write ! ( error, "\n ... ({diff } reducer{plural } not shown)" ) . unwrap ( ) ;
217211 }
218212 }
219213}
0 commit comments