Przeglądaj źródła

Remove clippy nits.

Kestrel 2 lat temu
rodzic
commit
919832d1e5

+ 7 - 1
microrm/src/model.rs

@@ -66,7 +66,7 @@ impl SchemaModel {
         }
     }
 
-    pub fn add<'de, E: Entity>(mut self) -> Self {
+    pub fn add<E: Entity>(mut self) -> Self {
         let (drop, create) = create::sql_for::<E>();
         self.drop.push(drop);
         self.create.push(create);
@@ -80,3 +80,9 @@ impl SchemaModel {
         &self.create
     }
 }
+
+impl Default for SchemaModel {
+    fn default() -> Self {
+        Self::new()
+    }
+}

+ 1 - 1
microrm/src/model/create.rs

@@ -60,7 +60,7 @@ impl<'de> serde::de::SeqAccess<'de> for CreateDeserializer<'de> {
     }
 }
 
-pub fn sql_for<'de, T: crate::model::Entity>() -> (String, String) {
+pub fn sql_for<T: crate::model::Entity>() -> (String, String) {
     let mut cd = CreateDeserializer {
         table_name: None,
         column_names: None,

+ 3 - 3
microrm/src/model/store.rs

@@ -1,5 +1,5 @@
-pub fn serialize_as_row<'data, T: crate::model::Entity>(
-    value: &'data T,
-) -> Vec<&'data dyn rusqlite::ToSql> {
+pub fn serialize_as_row<T: crate::model::Entity>(
+    value: &T,
+) -> Vec<&dyn rusqlite::ToSql> {
     value.values()
 }

+ 3 - 3
microrm/src/query.rs

@@ -13,7 +13,7 @@ impl<T: crate::model::Entity + crate::model::Entity> WithID<T> {
     fn wrap(what: T, raw_id: i64) -> Self {
         Self {
             wrap: what,
-            id: ID { 0: raw_id },
+            id: ID(raw_id)
         }
     }
 }
@@ -26,7 +26,7 @@ impl<T: crate::model::Entity + crate::model::Entity> WithID<T> {
 
 impl<T: crate::model::Entity + crate::model::Entity> AsRef<T> for WithID<T> {
     fn as_ref(&self) -> &T {
-        return &self.wrap;
+        &self.wrap
     }
 }
 
@@ -90,7 +90,7 @@ pub fn add<T: crate::model::Entity + serde::Serialize>(db: &DB, m: &T) -> Option
     assert_eq!(row.len(), <T as crate::model::Entity>::column_count());
 
     let id = prepared.insert(rusqlite::params_from_iter(row)).ok()?;
-    Some(ID { 0: id })
+    Some(ID(id))
 }
 
 pub struct Context<'a> {