@@ -43,6 +43,8 @@ impl<'args, DB: Database> Default for QueryBuilder<'args, DB> {
43
43
}
44
44
}
45
45
46
+ const ERROR : & str = "BUG: query must not be shared at this point in time" ;
47
+
46
48
impl < ' args , DB : Database > QueryBuilder < ' args , DB >
47
49
where
48
50
DB : Database ,
@@ -118,7 +120,7 @@ where
118
120
/// e.g. check that strings aren't too long, numbers are within expected ranges, etc.
119
121
pub fn push ( & mut self , sql : impl Display ) -> & mut Self {
120
122
self . sanity_check ( ) ;
121
- let query: & mut String = Arc :: get_mut ( & mut self . query ) . expect ( "" ) ;
123
+ let query: & mut String = Arc :: get_mut ( & mut self . query ) . expect ( ERROR ) ;
122
124
123
125
write ! ( query, "{sql}" ) . expect ( "error formatting `sql`" ) ;
124
126
@@ -161,7 +163,7 @@ where
161
163
. expect ( "BUG: Arguments taken already" ) ;
162
164
arguments. add ( value) . expect ( "Failed to add argument" ) ;
163
165
164
- let query: & mut String = Arc :: get_mut ( & mut self . query ) . expect ( "" ) ;
166
+ let query: & mut String = Arc :: get_mut ( & mut self . query ) . expect ( ERROR ) ;
165
167
arguments
166
168
. format_placeholder ( query)
167
169
. expect ( "error in format_placeholder" ) ;
@@ -511,7 +513,7 @@ where
511
513
/// The query is truncated to the initial fragment provided to [`new()`][Self::new] and
512
514
/// the bind arguments are reset.
513
515
pub fn reset ( & mut self ) -> & mut Self {
514
- let query: & mut String = Arc :: get_mut ( & mut self . query ) . expect ( "" ) ;
516
+ let query: & mut String = Arc :: get_mut ( & mut self . query ) . expect ( ERROR ) ;
515
517
query. truncate ( self . init_len ) ;
516
518
self . arguments = Some ( Default :: default ( ) ) ;
517
519
0 commit comments