diff --git a/wither/src/model.rs b/wither/src/model.rs index f37aa2d..e5b51a3 100644 --- a/wither/src/model.rs +++ b/wither/src/model.rs @@ -168,7 +168,7 @@ where /// write concern. async fn save(&mut self, db: &Database, filter: Option) -> Result<()> { let coll = Self::collection(db); - let instance_doc = Self::document_from_instance(&self)?; + let instance_doc = Self::document_from_instance(self)?; // Ensure that journaling is set to true for this call, as we need to be able to get an ID back. let mut write_concern = Self::write_concern().unwrap_or_default(); @@ -180,7 +180,7 @@ where (Some(id), _) => doc! {"_id": id}, (None, None) => { let new_id = ObjectId::new(); - self.set_id(new_id.clone()); + self.set_id(new_id); doc! {"_id": new_id} } (None, Some(filter)) => { @@ -202,8 +202,10 @@ where // Update instance ID if needed. if id_needs_update { - let response_id = updated_doc.get_object_id("_id").map_err(|_| WitherError::ServerFailedToReturnObjectId)?; - self.set_id(response_id.clone()); + let response_id = updated_doc + .get_object_id("_id") + .map_err(|_| WitherError::ServerFailedToReturnObjectId)?; + self.set_id(response_id); }; Ok(()) } @@ -322,7 +324,7 @@ where /// defined in this model's `indexes` method. async fn sync(db: &Database) -> Result<()> { let coll = Self::collection(db); - let current_indexes = get_current_indexes(&db, &coll).await?; + let current_indexes = get_current_indexes(db, &coll).await?; sync_model_indexes(db, &coll, Self::indexes(), current_indexes).await?; Ok(()) } diff --git a/wither_derive/src/model.rs b/wither_derive/src/model.rs index 184eec2..71f35ba 100644 --- a/wither_derive/src/model.rs +++ b/wither_derive/src/model.rs @@ -170,7 +170,7 @@ impl<'a> MetaModel<'a> { /// Extract any model attrs and bind them to their optional slots. fn extract_model_attrs(&mut self) { - let attrs = Self::parse_attrs(&self.attrs, MODEL_HELPER_ATTR); + let attrs = Self::parse_attrs(self.attrs, MODEL_HELPER_ATTR); // Parse over the internals of our `model` attrs. At this point, we are dealing with // individual elements inside of the various `model(...)` attrs. for attr_meta in attrs {