@@ -12,7 +12,7 @@ use crate::{
1212
1313use super :: connection:: Connection ;
1414
15- /// PSQLPool for internal use only.
15+ /// ` PSQLPool` for internal use only.
1616///
1717/// It is not exposed to python.
1818pub struct RustPSQLPool {
@@ -27,6 +27,7 @@ pub struct RustPSQLPool {
2727
2828impl RustPSQLPool {
2929 /// Create new `RustPSQLPool`.
30+ #[ must_use]
3031 pub fn new (
3132 username : Option < String > ,
3233 password : Option < String > ,
@@ -50,7 +51,7 @@ impl RustPSQLPool {
5051impl RustPSQLPool {
5152 /// Return new single connection.
5253 ///
53- /// # Errors:
54+ /// # Errors
5455 /// May return Err Result if cannot get new connection from the pool.
5556 pub async fn inner_connection ( & self ) -> RustPSQLDriverPyResult < Connection > {
5657 let db_pool_arc = self . db_pool . clone ( ) ;
@@ -73,7 +74,7 @@ impl RustPSQLPool {
7374 ///
7475 /// Prepare statement and cache it, then execute.
7576 ///
76- /// # Errors:
77+ /// # Errors
7778 /// May return Err Result if cannot retrieve new connection
7879 /// or prepare statement or execute statement.
7980 pub async fn inner_execute (
@@ -94,7 +95,7 @@ impl RustPSQLPool {
9495 . await ?;
9596
9697 let mut vec_parameters: Vec < & ( dyn ToSql + Sync ) > = Vec :: with_capacity ( parameters. len ( ) ) ;
97- for param in parameters. iter ( ) {
98+ for param in & parameters {
9899 vec_parameters. push ( param) ;
99100 }
100101
@@ -109,9 +110,9 @@ impl RustPSQLPool {
109110
110111 /// Create new Database pool.
111112 ///
112- /// # Errors:
113+ /// # Errors
113114 /// May return Err Result if Database pool is already initialized,
114- /// max_db_pool_size is less than 2 or it's impossible to build db pool.
115+ /// ` max_db_pool_size` is less than 2 or it's impossible to build db pool.
115116 pub async fn inner_startup ( & self ) -> RustPSQLDriverPyResult < ( ) > {
116117 let db_pool_arc = self . db_pool . clone ( ) ;
117118 let password = self . password . clone ( ) ;
@@ -177,6 +178,7 @@ pub struct PSQLPool {
177178#[ pymethods]
178179impl PSQLPool {
179180 #[ new]
181+ #[ must_use]
180182 pub fn new (
181183 username : Option < String > ,
182184 password : Option < String > ,
@@ -200,7 +202,7 @@ impl PSQLPool {
200202
201203 /// Startup Database Pool.
202204 ///
203- /// # Errors:
205+ /// # Errors
204206 /// May return Err Result if `inner_startup` returns error.
205207 pub fn startup < ' a > ( & ' a self , py : Python < ' a > ) -> RustPSQLDriverPyResult < & ' a PyAny > {
206208 let psql_pool_arc = self . rust_psql_pool . clone ( ) ;
@@ -213,7 +215,7 @@ impl PSQLPool {
213215
214216 /// Return single connection.
215217 ///
216- /// # Errors:
218+ /// # Errors
217219 /// May return Err Result if `inner_connection` returns error.
218220 pub fn connection < ' a > ( & ' a self , py : Python < ' a > ) -> RustPSQLDriverPyResult < & ' a PyAny > {
219221 let psql_pool_arc = self . rust_psql_pool . clone ( ) ;
@@ -226,7 +228,7 @@ impl PSQLPool {
226228
227229 /// Execute querystring with parameters.
228230 ///
229- /// # Errors:
231+ /// # Errors
230232 /// May return Err Result if cannot convert parameters
231233 /// or `inner_execute` returns Err.
232234 pub fn execute < ' a > (
@@ -238,7 +240,7 @@ impl PSQLPool {
238240 let engine_arc = self . rust_psql_pool . clone ( ) ;
239241 let mut params: Vec < PythonDTO > = vec ! [ ] ;
240242 if let Some ( parameters) = parameters {
241- params = convert_parameters ( parameters) ?
243+ params = convert_parameters ( parameters) ?;
242244 }
243245
244246 rustengine_future ( py, async move {
0 commit comments