diff --git a/.evergreen/check-clippy.sh b/.evergreen/check-clippy.sh index 572d8a710..8e5074a06 100755 --- a/.evergreen/check-clippy.sh +++ b/.evergreen/check-clippy.sh @@ -5,7 +5,7 @@ set -o errexit source ./.evergreen/env.sh # Pin clippy to the latest version. This should be updated when new versions of Rust are released. -CLIPPY_VERSION=1.88.0 +CLIPPY_VERSION=1.90.0 rustup install $CLIPPY_VERSION diff --git a/src/action/aggregate.rs b/src/action/aggregate.rs index ca12f5a67..10c21ac14 100644 --- a/src/action/aggregate.rs +++ b/src/action/aggregate.rs @@ -39,7 +39,7 @@ impl Database { /// called, the returned cursor will be generic over the `T` specified. #[deeplink] #[options_doc(aggregate)] - pub fn aggregate(&self, pipeline: impl IntoIterator) -> Aggregate { + pub fn aggregate(&self, pipeline: impl IntoIterator) -> Aggregate<'_> { Aggregate::new( AggregateTargetRef::Database(self), pipeline.into_iter().collect(), @@ -61,7 +61,7 @@ where /// called, the returned cursor will be generic over the `T` specified. #[deeplink] #[options_doc(aggregate)] - pub fn aggregate(&self, pipeline: impl IntoIterator) -> Aggregate { + pub fn aggregate(&self, pipeline: impl IntoIterator) -> Aggregate<'_> { Aggregate::new( AggregateTargetRef::Collection(CollRef::new(self)), pipeline.into_iter().collect(), @@ -82,7 +82,7 @@ impl crate::sync::Database { /// returned cursor will be generic over the `T` specified. #[deeplink] #[options_doc(aggregate, "run")] - pub fn aggregate(&self, pipeline: impl IntoIterator) -> Aggregate { + pub fn aggregate(&self, pipeline: impl IntoIterator) -> Aggregate<'_> { self.async_database.aggregate(pipeline) } } @@ -103,7 +103,7 @@ where /// returned cursor will be generic over the `T` specified. #[deeplink] #[options_doc(aggregate, "run")] - pub fn aggregate(&self, pipeline: impl IntoIterator) -> Aggregate { + pub fn aggregate(&self, pipeline: impl IntoIterator) -> Aggregate<'_> { self.async_collection.aggregate(pipeline) } } diff --git a/src/action/bulk_write.rs b/src/action/bulk_write.rs index 1a0ae3d77..7408771d1 100644 --- a/src/action/bulk_write.rs +++ b/src/action/bulk_write.rs @@ -30,7 +30,7 @@ impl Client { pub fn bulk_write( &self, models: impl IntoIterator>, - ) -> BulkWrite { + ) -> BulkWrite<'_, SummaryBulkWriteResult> { let mut models_vec = Vec::new(); for model in models.into_iter() { models_vec.push(model.into()); @@ -58,7 +58,7 @@ impl crate::sync::Client { pub fn bulk_write( &self, models: impl IntoIterator>, - ) -> BulkWrite { + ) -> BulkWrite<'_, SummaryBulkWriteResult> { self.async_client.bulk_write(models) } } diff --git a/src/action/count.rs b/src/action/count.rs index 587b4b267..33edfcff1 100644 --- a/src/action/count.rs +++ b/src/action/count.rs @@ -32,7 +32,7 @@ where /// `await` will return d[`Result`]. #[deeplink] #[options_doc(estimated_doc_count)] - pub fn estimated_document_count(&self) -> EstimatedDocumentCount { + pub fn estimated_document_count(&self) -> EstimatedDocumentCount<'_> { EstimatedDocumentCount { cr: CollRef::new(self), options: None, @@ -49,7 +49,7 @@ where /// `await` will return d[`Result`]. #[deeplink] #[options_doc(count_docs)] - pub fn count_documents(&self, filter: Document) -> CountDocuments { + pub fn count_documents(&self, filter: Document) -> CountDocuments<'_> { CountDocuments { cr: CollRef::new(self), filter, @@ -79,7 +79,7 @@ where /// [`run`](EstimatedDocumentCount::run) will return d[`Result`]. #[deeplink] #[options_doc(estimated_doc_count, "run")] - pub fn estimated_document_count(&self) -> EstimatedDocumentCount { + pub fn estimated_document_count(&self) -> EstimatedDocumentCount<'_> { self.async_collection.estimated_document_count() } @@ -90,7 +90,7 @@ where /// [`run`](CountDocuments::run) will return d[`Result`]. #[deeplink] #[options_doc(count_docs, "run")] - pub fn count_documents(&self, filter: Document) -> CountDocuments { + pub fn count_documents(&self, filter: Document) -> CountDocuments<'_> { self.async_collection.count_documents(filter) } } diff --git a/src/action/create_collection.rs b/src/action/create_collection.rs index 41f777999..b7dabeaab 100644 --- a/src/action/create_collection.rs +++ b/src/action/create_collection.rs @@ -28,7 +28,7 @@ impl Database { /// `await` will return d[`Result<()>`]. #[deeplink] #[options_doc(create_coll)] - pub fn create_collection(&self, name: impl Into) -> CreateCollection { + pub fn create_collection(&self, name: impl Into) -> CreateCollection<'_> { CreateCollection { db: self, name: name.into(), @@ -48,7 +48,7 @@ impl crate::sync::Database { /// [`run`](CreateCollection::run) will return d[`Result<()>`]. #[deeplink] #[options_doc(create_coll, "run")] - pub fn create_collection(&self, name: impl Into) -> CreateCollection { + pub fn create_collection(&self, name: impl Into) -> CreateCollection<'_> { self.async_database.create_collection(name) } } diff --git a/src/action/create_index.rs b/src/action/create_index.rs index bd420acf8..52d062708 100644 --- a/src/action/create_index.rs +++ b/src/action/create_index.rs @@ -33,7 +33,7 @@ where /// `await` will return d[`Result`]. #[deeplink] #[options_doc(create_index)] - pub fn create_index(&self, index: IndexModel) -> CreateIndex { + pub fn create_index(&self, index: IndexModel) -> CreateIndex<'_> { CreateIndex { coll: CollRef::new(self), indexes: vec![index], @@ -72,7 +72,7 @@ where /// [`run`](CreateIndex::run) will return d[`Result`]. #[deeplink] #[options_doc(create_index, "run")] - pub fn create_index(&self, index: IndexModel) -> CreateIndex { + pub fn create_index(&self, index: IndexModel) -> CreateIndex<'_> { self.async_collection.create_index(index) } diff --git a/src/action/csfle/create_data_key.rs b/src/action/csfle/create_data_key.rs index 555fb4c65..58789bfcd 100644 --- a/src/action/csfle/create_data_key.rs +++ b/src/action/csfle/create_data_key.rs @@ -12,7 +12,7 @@ impl ClientEncryption { /// document as a UUID. #[deeplink] #[options_doc(create_data_keys)] - pub fn create_data_key(&self, master_key: impl Into) -> CreateDataKey { + pub fn create_data_key(&self, master_key: impl Into) -> CreateDataKey<'_> { CreateDataKey { client_enc: self, master_key: master_key.into(), diff --git a/src/action/csfle/encrypt.rs b/src/action/csfle/encrypt.rs index 1e2c99fcd..066427cd7 100644 --- a/src/action/csfle/encrypt.rs +++ b/src/action/csfle/encrypt.rs @@ -25,7 +25,7 @@ impl ClientEncryption { value: impl Into, key: impl Into, algorithm: Algorithm, - ) -> Encrypt { + ) -> Encrypt<'_> { Encrypt { client_enc: self, mode: Value { diff --git a/src/action/delete.rs b/src/action/delete.rs index d94532314..a4c78dd9c 100644 --- a/src/action/delete.rs +++ b/src/action/delete.rs @@ -27,7 +27,7 @@ where /// `await` will return d[`Result`]. #[deeplink] #[options_doc(delete)] - pub fn delete_one(&self, query: Document) -> Delete { + pub fn delete_one(&self, query: Document) -> Delete<'_> { Delete { coll: CollRef::new(self), query, @@ -42,7 +42,7 @@ where /// `await` will return d[`Result`]. #[deeplink] #[options_doc(delete)] - pub fn delete_many(&self, query: Document) -> Delete { + pub fn delete_many(&self, query: Document) -> Delete<'_> { Delete { coll: CollRef::new(self), query, @@ -68,7 +68,7 @@ where /// [`run`](Delete::run) will return d[`Result`]. #[deeplink] #[options_doc(delete, "run")] - pub fn delete_one(&self, query: Document) -> Delete { + pub fn delete_one(&self, query: Document) -> Delete<'_> { self.async_collection.delete_one(query) } @@ -77,7 +77,7 @@ where /// [`run`](Delete::run) will return d[`Result`]. #[deeplink] #[options_doc(delete, "run")] - pub fn delete_many(&self, query: Document) -> Delete { + pub fn delete_many(&self, query: Document) -> Delete<'_> { self.async_collection.delete_many(query) } } diff --git a/src/action/distinct.rs b/src/action/distinct.rs index f245f0afd..dcf5870e5 100644 --- a/src/action/distinct.rs +++ b/src/action/distinct.rs @@ -24,7 +24,7 @@ where /// `await` will return d[`Result>`]. #[deeplink] #[options_doc(distinct)] - pub fn distinct(&self, field_name: impl AsRef, filter: Document) -> Distinct { + pub fn distinct(&self, field_name: impl AsRef, filter: Document) -> Distinct<'_> { Distinct { coll: CollRef::new(self), field_name: field_name.as_ref().to_string(), @@ -45,7 +45,7 @@ where /// [`run`](Distinct::run) will return d[`Result>`]. #[deeplink] #[options_doc(distinct, "run")] - pub fn distinct(&self, field_name: impl AsRef, filter: Document) -> Distinct { + pub fn distinct(&self, field_name: impl AsRef, filter: Document) -> Distinct<'_> { self.async_collection.distinct(field_name, filter) } } diff --git a/src/action/drop.rs b/src/action/drop.rs index 374dd084d..6447ae3b3 100644 --- a/src/action/drop.rs +++ b/src/action/drop.rs @@ -20,7 +20,7 @@ impl Database { /// `await` will return d[`Result<()>`]. #[deeplink] #[options_doc(drop_db)] - pub fn drop(&self) -> DropDatabase { + pub fn drop(&self) -> DropDatabase<'_> { DropDatabase { db: self, options: None, @@ -36,7 +36,7 @@ impl crate::sync::Database { /// [`run`](DropDatabase::run) will return d[`Result<()>`]. #[deeplink] #[options_doc(drop_db, "run")] - pub fn drop(&self) -> DropDatabase { + pub fn drop(&self) -> DropDatabase<'_> { self.async_database.drop() } } @@ -80,7 +80,7 @@ where /// `await` will return d[`Result<()>`]. #[deeplink] #[options_doc(drop_coll)] - pub fn drop(&self) -> DropCollection { + pub fn drop(&self) -> DropCollection<'_> { DropCollection { cr: CollRef::new(self), options: None, @@ -99,7 +99,7 @@ where /// [`run`](DropCollection::run) will return d[`Result<()>`]. #[deeplink] #[options_doc(drop_coll, "run")] - pub fn drop(&self) -> DropCollection { + pub fn drop(&self) -> DropCollection<'_> { self.async_collection.drop() } } diff --git a/src/action/drop_index.rs b/src/action/drop_index.rs index 2ec816ce4..f70febce0 100644 --- a/src/action/drop_index.rs +++ b/src/action/drop_index.rs @@ -22,7 +22,7 @@ where /// `await` will return d[`Result<()>`]. #[deeplink] #[options_doc(drop_index)] - pub fn drop_index(&self, name: impl AsRef) -> DropIndex { + pub fn drop_index(&self, name: impl AsRef) -> DropIndex<'_> { DropIndex { coll: CollRef::new(self), name: Some(name.as_ref().to_string()), @@ -36,7 +36,7 @@ where /// `await` will return d[`Result<()>`]. #[deeplink] #[options_doc(drop_index)] - pub fn drop_indexes(&self) -> DropIndex { + pub fn drop_indexes(&self) -> DropIndex<'_> { DropIndex { coll: CollRef::new(self), name: None, @@ -56,7 +56,7 @@ where /// [`run`](DropIndex::run) will return d[`Result<()>`]. #[deeplink] #[options_doc(drop_index, "run")] - pub fn drop_index(&self, name: impl AsRef) -> DropIndex { + pub fn drop_index(&self, name: impl AsRef) -> DropIndex<'_> { self.async_collection.drop_index(name) } @@ -65,7 +65,7 @@ where /// [`run`](DropIndex::run) will return d[`Result<()>`]. #[deeplink] #[options_doc(drop_index, "run")] - pub fn drop_indexes(&self) -> DropIndex { + pub fn drop_indexes(&self) -> DropIndex<'_> { self.async_collection.drop_indexes() } } diff --git a/src/action/gridfs/delete.rs b/src/action/gridfs/delete.rs index 99c0534fd..e95a399df 100644 --- a/src/action/gridfs/delete.rs +++ b/src/action/gridfs/delete.rs @@ -14,7 +14,7 @@ impl GridFsBucket { /// bucket. /// /// `await` will return [`Result<()>`]. - pub fn delete(&self, id: Bson) -> Delete { + pub fn delete(&self, id: Bson) -> Delete<'_> { Delete { bucket: self, id } } @@ -23,7 +23,7 @@ impl GridFsBucket { /// bucket. /// /// `await` will return [`Result<()>`]. - pub fn delete_by_name(&self, filename: impl Into) -> DeleteByName { + pub fn delete_by_name(&self, filename: impl Into) -> DeleteByName<'_> { DeleteByName { bucket: self, filename: filename.into(), @@ -38,7 +38,7 @@ impl crate::sync::gridfs::GridFsBucket { /// bucket. /// /// [`run`](Delete::run) will return [`Result<()>`]. - pub fn delete(&self, id: Bson) -> Delete { + pub fn delete(&self, id: Bson) -> Delete<'_> { self.async_bucket.delete(id) } @@ -47,7 +47,7 @@ impl crate::sync::gridfs::GridFsBucket { /// bucket. /// /// [`run`](DeleteByName::run) will return [`Result<()>`]. - pub fn delete_by_name(&self, filename: impl Into) -> DeleteByName { + pub fn delete_by_name(&self, filename: impl Into) -> DeleteByName<'_> { self.async_bucket.delete_by_name(filename) } } diff --git a/src/action/gridfs/download.rs b/src/action/gridfs/download.rs index d931fb6c6..fb1a67b56 100644 --- a/src/action/gridfs/download.rs +++ b/src/action/gridfs/download.rs @@ -17,7 +17,7 @@ impl GridFsBucket { /// /// `await` will return d[`Result`]. #[deeplink] - pub fn open_download_stream(&self, id: Bson) -> OpenDownloadStream { + pub fn open_download_stream(&self, id: Bson) -> OpenDownloadStream<'_> { OpenDownloadStream { bucket: self, id } } @@ -35,7 +35,7 @@ impl GridFsBucket { pub fn open_download_stream_by_name( &self, filename: impl Into, - ) -> OpenDownloadStreamByName { + ) -> OpenDownloadStreamByName<'_> { OpenDownloadStreamByName { bucket: self, filename: filename.into(), @@ -101,7 +101,7 @@ impl crate::sync::gridfs::GridFsBucket { /// /// [`run`](OpenDownloadStream::run) will return d[`Result`]. #[deeplink] - pub fn open_download_stream(&self, id: Bson) -> OpenDownloadStream { + pub fn open_download_stream(&self, id: Bson) -> OpenDownloadStream<'_> { self.async_bucket.open_download_stream(id) } @@ -119,7 +119,7 @@ impl crate::sync::gridfs::GridFsBucket { pub fn open_download_stream_by_name( &self, filename: impl Into, - ) -> OpenDownloadStreamByName { + ) -> OpenDownloadStreamByName<'_> { self.async_bucket.open_download_stream_by_name(filename) } } diff --git a/src/action/gridfs/drop.rs b/src/action/gridfs/drop.rs index a63b72731..ea4f2fb2d 100644 --- a/src/action/gridfs/drop.rs +++ b/src/action/gridfs/drop.rs @@ -4,7 +4,7 @@ impl GridFsBucket { /// Removes all of the files and their associated chunks from this bucket. /// /// `await` will return [`Result<()>`]. - pub fn drop(&self) -> Drop { + pub fn drop(&self) -> Drop<'_> { Drop { bucket: self } } } @@ -14,7 +14,7 @@ impl crate::sync::gridfs::GridFsBucket { /// Removes all of the files and their associated chunks from this bucket. /// /// [`run`](Drop::run) will return [`Result<()>`]. - pub fn drop(&self) -> Drop { + pub fn drop(&self) -> Drop<'_> { self.async_bucket.drop() } } diff --git a/src/action/gridfs/find.rs b/src/action/gridfs/find.rs index afb663457..ac66c7a8b 100644 --- a/src/action/gridfs/find.rs +++ b/src/action/gridfs/find.rs @@ -17,7 +17,7 @@ impl GridFsBucket { /// `await` will return d[`Result>`]. #[deeplink] #[options_doc(find)] - pub fn find(&self, filter: Document) -> Find { + pub fn find(&self, filter: Document) -> Find<'_> { Find { bucket: self, filter, @@ -31,7 +31,7 @@ impl GridFsBucket { /// `await` will return d[`Result>`]. #[deeplink] #[options_doc(find_one)] - pub fn find_one(&self, filter: Document) -> FindOne { + pub fn find_one(&self, filter: Document) -> FindOne<'_> { FindOne { bucket: self, filter, @@ -48,7 +48,7 @@ impl crate::sync::gridfs::GridFsBucket { /// [`run`](Find::run) will return d[`Result>`]. #[deeplink] #[options_doc(find, "run")] - pub fn find(&self, filter: Document) -> Find { + pub fn find(&self, filter: Document) -> Find<'_> { self.async_bucket.find(filter) } @@ -58,7 +58,7 @@ impl crate::sync::gridfs::GridFsBucket { /// [`run`](FindOne::run) will return d[`Result>`]. #[deeplink] #[options_doc(find_one, "run")] - pub fn find_one(&self, filter: Document) -> FindOne { + pub fn find_one(&self, filter: Document) -> FindOne<'_> { self.async_bucket.find_one(filter) } } diff --git a/src/action/gridfs/rename.rs b/src/action/gridfs/rename.rs index b60a28d52..5d8928d58 100644 --- a/src/action/gridfs/rename.rs +++ b/src/action/gridfs/rename.rs @@ -11,7 +11,7 @@ impl GridFsBucket { /// error if the `id` does not match any files in the bucket. /// /// `await` will return [`Result<()>`]. - pub fn rename(&self, id: Bson, new_filename: impl Into) -> Rename { + pub fn rename(&self, id: Bson, new_filename: impl Into) -> Rename<'_> { Rename { bucket: self, id, @@ -27,7 +27,7 @@ impl GridFsBucket { &self, filename: impl Into, new_filename: impl Into, - ) -> RenameByName { + ) -> RenameByName<'_> { RenameByName { bucket: self, filename: filename.into(), @@ -42,7 +42,7 @@ impl crate::sync::gridfs::GridFsBucket { /// error if the `id` does not match any files in the bucket. /// /// [`run`](Rename::run) will return [`Result<()>`]. - pub fn rename(&self, id: Bson, new_filename: impl Into) -> Rename { + pub fn rename(&self, id: Bson, new_filename: impl Into) -> Rename<'_> { self.async_bucket.rename(id, new_filename) } @@ -54,7 +54,7 @@ impl crate::sync::gridfs::GridFsBucket { &self, filename: impl Into, new_filename: impl Into, - ) -> RenameByName { + ) -> RenameByName<'_> { self.async_bucket.rename_by_name(filename, new_filename) } } diff --git a/src/action/gridfs/upload.rs b/src/action/gridfs/upload.rs index fdfbbfe8b..5541614be 100644 --- a/src/action/gridfs/upload.rs +++ b/src/action/gridfs/upload.rs @@ -15,7 +15,7 @@ impl GridFsBucket { /// `await` will return d[`Result`]. #[deeplink] #[options_doc(open_upload_stream)] - pub fn open_upload_stream(&self, filename: impl AsRef) -> OpenUploadStream { + pub fn open_upload_stream(&self, filename: impl AsRef) -> OpenUploadStream<'_> { OpenUploadStream { bucket: self, filename: filename.as_ref().to_owned(), @@ -33,7 +33,7 @@ impl crate::sync::gridfs::GridFsBucket { /// [`run`](OpenUploadStream::run) will return d[`Result`]. #[deeplink] #[options_doc(open_upload_stream, "run")] - pub fn open_upload_stream(&self, filename: impl AsRef) -> OpenUploadStream { + pub fn open_upload_stream(&self, filename: impl AsRef) -> OpenUploadStream<'_> { self.async_bucket.open_upload_stream(filename) } } diff --git a/src/action/insert_many.rs b/src/action/insert_many.rs index 6bb4b8e7d..dc39c6990 100644 --- a/src/action/insert_many.rs +++ b/src/action/insert_many.rs @@ -29,7 +29,7 @@ impl Collection { /// `await` will return d[`Result`]. #[deeplink] #[options_doc(insert_many)] - pub fn insert_many(&self, docs: impl IntoIterator>) -> InsertMany { + pub fn insert_many(&self, docs: impl IntoIterator>) -> InsertMany<'_> { InsertMany { coll: CollRef::new(self), docs: docs @@ -60,7 +60,7 @@ impl crate::sync::Collection { /// [`run`](InsertMany::run) will return d[`Result`]. #[deeplink] #[options_doc(insert_many, "run")] - pub fn insert_many(&self, docs: impl IntoIterator>) -> InsertMany { + pub fn insert_many(&self, docs: impl IntoIterator>) -> InsertMany<'_> { self.async_collection.insert_many(docs) } } diff --git a/src/action/insert_one.rs b/src/action/insert_one.rs index 7699f1636..3b8e10c47 100644 --- a/src/action/insert_one.rs +++ b/src/action/insert_one.rs @@ -29,7 +29,7 @@ impl Collection { /// `await` will return d[`Result`]. #[deeplink] #[options_doc(insert_one)] - pub fn insert_one(&self, doc: impl Borrow) -> InsertOne { + pub fn insert_one(&self, doc: impl Borrow) -> InsertOne<'_> { InsertOne { coll: CollRef::new(self), doc: crate::bson_compat::serialize_to_raw_document_buf(doc.borrow()) @@ -55,7 +55,7 @@ impl crate::sync::Collection { /// [`run`](InsertOne::run) will return d[`Result`]. #[deeplink] #[options_doc(insert_one, "run")] - pub fn insert_one(&self, doc: impl Borrow) -> InsertOne { + pub fn insert_one(&self, doc: impl Borrow) -> InsertOne<'_> { self.async_collection.insert_one(doc) } } diff --git a/src/action/list_collections.rs b/src/action/list_collections.rs index 60fcffa4a..08cb70f66 100644 --- a/src/action/list_collections.rs +++ b/src/action/list_collections.rs @@ -32,7 +32,7 @@ impl Database { /// `await` will return d[`Result>`]. #[deeplink] #[options_doc(list_collections)] - pub fn list_collections(&self) -> ListCollections { + pub fn list_collections(&self) -> ListCollections<'_> { ListCollections { db: self, options: None, @@ -64,7 +64,7 @@ impl crate::sync::Database { /// d[`Result>`]. #[deeplink] #[options_doc(list_collections, "run")] - pub fn list_collections(&self) -> ListCollections { + pub fn list_collections(&self) -> ListCollections<'_> { self.async_database.list_collections() } diff --git a/src/action/list_databases.rs b/src/action/list_databases.rs index 79838c811..6f38c9ae6 100644 --- a/src/action/list_databases.rs +++ b/src/action/list_databases.rs @@ -29,7 +29,7 @@ impl Client { /// `await` will return d[`Result>`]. #[deeplink] #[options_doc(list_databases)] - pub fn list_databases(&self) -> ListDatabases { + pub fn list_databases(&self) -> ListDatabases<'_> { ListDatabases { client: self, options: Default::default(), @@ -60,7 +60,7 @@ impl SyncClient { /// [run](ListDatabases::run) will return d[`Result>`]. #[deeplink] #[options_doc(list_databases, "run")] - pub fn list_databases(&self) -> ListDatabases { + pub fn list_databases(&self) -> ListDatabases<'_> { self.async_client.list_databases() } diff --git a/src/action/list_indexes.rs b/src/action/list_indexes.rs index 51808722f..7076315b4 100644 --- a/src/action/list_indexes.rs +++ b/src/action/list_indexes.rs @@ -37,7 +37,7 @@ where /// d[`Result>`] if a `ClientSession` is provided). #[deeplink] #[options_doc(list_indexes)] - pub fn list_indexes(&self) -> ListIndexes { + pub fn list_indexes(&self) -> ListIndexes<'_> { ListIndexes { coll: CollRef::new(self), options: None, @@ -51,7 +51,7 @@ where /// `await` will return d[`Result>`]. #[deeplink] #[options_doc(list_indexes)] - pub fn list_index_names(&self) -> ListIndexes { + pub fn list_index_names(&self) -> ListIndexes<'_, ListNames> { ListIndexes { coll: CollRef::new(self), options: None, @@ -72,7 +72,7 @@ where /// d[`Result>`] if a `ClientSession` is provided). #[deeplink] #[options_doc(list_indexes, "run")] - pub fn list_indexes(&self) -> ListIndexes { + pub fn list_indexes(&self) -> ListIndexes<'_> { self.async_collection.list_indexes() } @@ -81,7 +81,7 @@ where /// [`run`](ListIndexes::run) will return d[`Result>`]. #[deeplink] #[options_doc(list_indexes, "run")] - pub fn list_index_names(&self) -> ListIndexes { + pub fn list_index_names(&self) -> ListIndexes<'_, ListNames> { self.async_collection.list_index_names() } } diff --git a/src/action/perf.rs b/src/action/perf.rs index 5d33e5727..4af6fbb53 100644 --- a/src/action/perf.rs +++ b/src/action/perf.rs @@ -13,7 +13,7 @@ impl Client { /// Does nothing if `min_pool_size` is unset or zero. /// /// `await` will return `()`. - pub fn warm_connection_pool(&self) -> WarmConnectionPool { + pub fn warm_connection_pool(&self) -> WarmConnectionPool<'_> { WarmConnectionPool { client: self } } } @@ -32,7 +32,7 @@ impl crate::sync::Client { /// Does nothing if `min_pool_size` is unset or zero. /// /// [`run`](WarmConnectionPool::run) will return `()`. - pub fn warm_connection_pool(&self) -> WarmConnectionPool { + pub fn warm_connection_pool(&self) -> WarmConnectionPool<'_> { self.async_client.warm_connection_pool() } } diff --git a/src/action/replace_one.rs b/src/action/replace_one.rs index 8504cfa16..9556a3a9a 100644 --- a/src/action/replace_one.rs +++ b/src/action/replace_one.rs @@ -27,7 +27,7 @@ impl Collection { /// `await` will return d[`Result`]. #[deeplink] #[options_doc(replace_one)] - pub fn replace_one(&self, query: Document, replacement: impl Borrow) -> ReplaceOne { + pub fn replace_one(&self, query: Document, replacement: impl Borrow) -> ReplaceOne<'_> { ReplaceOne { coll: CollRef::new(self), query, @@ -51,7 +51,7 @@ impl crate::sync::Collection { /// [`run`](ReplaceOne::run) will return d[`Result`]. #[deeplink] #[options_doc(replace_one, "run")] - pub fn replace_one(&self, query: Document, replacement: impl Borrow) -> ReplaceOne { + pub fn replace_one(&self, query: Document, replacement: impl Borrow) -> ReplaceOne<'_> { self.async_collection.replace_one(query, replacement) } } diff --git a/src/action/run_command.rs b/src/action/run_command.rs index cc8c85b7f..04171275f 100644 --- a/src/action/run_command.rs +++ b/src/action/run_command.rs @@ -38,7 +38,7 @@ impl Database { /// `await` will return d[`Result`]. #[deeplink] #[options_doc(run_command)] - pub fn run_command(&self, command: Document) -> RunCommand { + pub fn run_command(&self, command: Document) -> RunCommand<'_> { RunCommand { db: self, command: RawDocumentBuf::try_from(&command), @@ -58,7 +58,7 @@ impl Database { /// `await` will return d[`Result`]. #[deeplink] #[options_doc(run_command)] - pub fn run_raw_command(&self, command: RawDocumentBuf) -> RunCommand { + pub fn run_raw_command(&self, command: RawDocumentBuf) -> RunCommand<'_> { RunCommand { db: self, command: Ok(command), @@ -73,7 +73,7 @@ impl Database { /// d[`Result>`] if a [`ClientSession`] is provided. #[deeplink] #[options_doc(run_cursor_command)] - pub fn run_cursor_command(&self, command: Document) -> RunCursorCommand { + pub fn run_cursor_command(&self, command: Document) -> RunCursorCommand<'_> { RunCursorCommand { db: self, command: RawDocumentBuf::try_from(&command), @@ -88,7 +88,7 @@ impl Database { /// d[`Result>`] if a [`ClientSession`] is provided. #[deeplink] #[options_doc(run_cursor_command)] - pub fn run_raw_cursor_command(&self, command: RawDocumentBuf) -> RunCursorCommand { + pub fn run_raw_cursor_command(&self, command: RawDocumentBuf) -> RunCursorCommand<'_> { RunCursorCommand { db: self, command: Ok(command), @@ -111,7 +111,7 @@ impl crate::sync::Database { /// [`run`](RunCommand::run) will return d[`Result`]. #[deeplink] #[options_doc(run_command, "run")] - pub fn run_command(&self, command: Document) -> RunCommand { + pub fn run_command(&self, command: Document) -> RunCommand<'_> { self.async_database.run_command(command) } @@ -126,7 +126,7 @@ impl crate::sync::Database { /// [`run`](RunCommand::run) will return d[`Result`]. #[deeplink] #[options_doc(run_command, "run")] - pub fn run_raw_command(&self, command: RawDocumentBuf) -> RunCommand { + pub fn run_raw_command(&self, command: RawDocumentBuf) -> RunCommand<'_> { self.async_database.run_raw_command(command) } @@ -136,7 +136,7 @@ impl crate::sync::Database { /// d[`Result>`] if a [`ClientSession`] is provided. #[deeplink] #[options_doc(run_cursor_command, "run")] - pub fn run_cursor_command(&self, command: Document) -> RunCursorCommand { + pub fn run_cursor_command(&self, command: Document) -> RunCursorCommand<'_> { self.async_database.run_cursor_command(command) } @@ -146,7 +146,7 @@ impl crate::sync::Database { /// d[`Result>`] if a [`ClientSession`] is provided. #[deeplink] #[options_doc(run_cursor_command, "run")] - pub fn run_raw_cursor_command(&self, command: RawDocumentBuf) -> RunCursorCommand { + pub fn run_raw_cursor_command(&self, command: RawDocumentBuf) -> RunCursorCommand<'_> { self.async_database.run_raw_cursor_command(command) } } diff --git a/src/action/search_index.rs b/src/action/search_index.rs index b1fe5436a..9903a1be6 100644 --- a/src/action/search_index.rs +++ b/src/action/search_index.rs @@ -39,7 +39,7 @@ where pub fn create_search_indexes( &self, models: impl IntoIterator, - ) -> CreateSearchIndex { + ) -> CreateSearchIndex<'_, Multiple> { CreateSearchIndex { coll: CollRef::new(self), models: models.into_iter().collect(), @@ -53,7 +53,7 @@ where /// `await` will return d[`Result`]. #[deeplink] #[options_doc(create_search_index)] - pub fn create_search_index(&self, model: SearchIndexModel) -> CreateSearchIndex { + pub fn create_search_index(&self, model: SearchIndexModel) -> CreateSearchIndex<'_, Single> { CreateSearchIndex { coll: CollRef::new(self), models: vec![model], @@ -70,7 +70,7 @@ where &self, name: impl Into, definition: Document, - ) -> UpdateSearchIndex { + ) -> UpdateSearchIndex<'_> { UpdateSearchIndex { coll: CollRef::new(self), name: name.into(), @@ -83,7 +83,7 @@ where /// /// `await` will return [`Result<()>`]. #[options_doc(drop_search_index)] - pub fn drop_search_index(&self, name: impl Into) -> DropSearchIndex { + pub fn drop_search_index(&self, name: impl Into) -> DropSearchIndex<'_> { DropSearchIndex { coll: CollRef::new(self), name: name.into(), @@ -99,7 +99,7 @@ where /// `await` will return d[`Result>`]. #[deeplink] #[options_doc(list_search_indexes)] - pub fn list_search_indexes(&self) -> ListSearchIndexes { + pub fn list_search_indexes(&self) -> ListSearchIndexes<'_> { ListSearchIndexes { coll: CollRef::new(self), name: None, @@ -122,7 +122,7 @@ where pub fn create_search_indexes( &self, models: impl IntoIterator, - ) -> CreateSearchIndex { + ) -> CreateSearchIndex<'_, Multiple> { self.async_collection.create_search_indexes(models) } @@ -131,7 +131,7 @@ where /// [`run`](CreateSearchIndex::run) will return d[`Result`]. #[deeplink] #[options_doc(create_search_index, "run")] - pub fn create_search_index(&self, model: SearchIndexModel) -> CreateSearchIndex { + pub fn create_search_index(&self, model: SearchIndexModel) -> CreateSearchIndex<'_, Single> { self.async_collection.create_search_index(model) } @@ -143,7 +143,7 @@ where &self, name: impl Into, definition: Document, - ) -> UpdateSearchIndex { + ) -> UpdateSearchIndex<'_> { self.async_collection.update_search_index(name, definition) } @@ -151,7 +151,7 @@ where /// /// [`run`](DropSearchIndex::run) will return [`Result<()>`]. #[options_doc(drop_search_index, "run")] - pub fn drop_search_index(&self, name: impl Into) -> DropSearchIndex { + pub fn drop_search_index(&self, name: impl Into) -> DropSearchIndex<'_> { self.async_collection.drop_search_index(name) } @@ -163,7 +163,7 @@ where /// [`run`](ListSearchIndexes::run) will return d[`Result>`]. #[deeplink] #[options_doc(list_search_indexes, "run")] - pub fn list_search_indexes(&self) -> ListSearchIndexes { + pub fn list_search_indexes(&self) -> ListSearchIndexes<'_> { self.async_collection.list_search_indexes() } } diff --git a/src/action/session.rs b/src/action/session.rs index ad16f0fac..f40bd19e5 100644 --- a/src/action/session.rs +++ b/src/action/session.rs @@ -13,7 +13,7 @@ impl Client { /// `await` will return d[`Result`]. #[deeplink] #[options_doc(start_session)] - pub fn start_session(&self) -> StartSession { + pub fn start_session(&self) -> StartSession<'_> { StartSession { client: self, options: None, @@ -28,7 +28,7 @@ impl crate::sync::Client { /// [run](StartSession::run) will return d[`Result`]. #[deeplink] #[options_doc(start_session, "run")] - pub fn start_session(&self) -> StartSession { + pub fn start_session(&self) -> StartSession<'_> { self.async_client.start_session() } } diff --git a/src/action/transaction.rs b/src/action/transaction.rs index ea5242622..8d2f2c27d 100644 --- a/src/action/transaction.rs +++ b/src/action/transaction.rs @@ -70,7 +70,7 @@ impl ClientSession { /// retryable writes. /// /// `await` will return [`Result<()>`]. - pub fn commit_transaction(&mut self) -> CommitTransaction { + pub fn commit_transaction(&mut self) -> CommitTransaction<'_> { CommitTransaction { session: self } } @@ -105,7 +105,7 @@ impl ClientSession { /// retryable writes. /// /// `await` will return [`Result<()>`]. - pub fn abort_transaction(&mut self) -> AbortTransaction { + pub fn abort_transaction(&mut self) -> AbortTransaction<'_> { AbortTransaction { session: self } } } @@ -162,7 +162,7 @@ impl crate::sync::ClientSession { /// retryable writes. /// /// [`run`](CommitTransaction::run) will return [`Result<()>`]. - pub fn commit_transaction(&mut self) -> CommitTransaction { + pub fn commit_transaction(&mut self) -> CommitTransaction<'_> { self.async_client_session.commit_transaction() } @@ -187,7 +187,7 @@ impl crate::sync::ClientSession { /// fn execute_transaction(coll: Collection, session: &mut ClientSession) -> Result<()> { /// coll.insert_one(doc! { "x": 1 }).session(&mut *session).run()?; /// coll.delete_one(doc! { "y": 2 }).session(&mut *session).run()?; - /// Ok(()) + /// Ok(()) /// } /// ``` /// @@ -197,7 +197,7 @@ impl crate::sync::ClientSession { /// retryable writes. /// /// [`run`](AbortTransaction::run) will return [`Result<()>`]. - pub fn abort_transaction(&mut self) -> AbortTransaction { + pub fn abort_transaction(&mut self) -> AbortTransaction<'_> { self.async_client_session.abort_transaction() } } diff --git a/src/action/update.rs b/src/action/update.rs index d0507568d..1fe38912c 100644 --- a/src/action/update.rs +++ b/src/action/update.rs @@ -26,7 +26,11 @@ where /// `await` will return d[`Result`]. #[deeplink] #[options_doc(update)] - pub fn update_many(&self, query: Document, update: impl Into) -> Update { + pub fn update_many( + &self, + query: Document, + update: impl Into, + ) -> Update<'_> { Update { coll: CollRef::new(self), query, @@ -51,7 +55,11 @@ where /// `await` will return d[`Result`]. #[deeplink] #[options_doc(update)] - pub fn update_one(&self, query: Document, update: impl Into) -> Update { + pub fn update_one( + &self, + query: Document, + update: impl Into, + ) -> Update<'_> { Update { coll: CollRef::new(self), query, @@ -77,7 +85,11 @@ where /// [`run`](Update::run) will return d[`Result`]. #[deeplink] #[options_doc(update, "run")] - pub fn update_many(&self, query: Document, update: impl Into) -> Update { + pub fn update_many( + &self, + query: Document, + update: impl Into, + ) -> Update<'_> { self.async_collection.update_many(query, update) } @@ -95,7 +107,11 @@ where /// [`run`](Update::run) will return d[`Result`]. #[deeplink] #[options_doc(update, "run")] - pub fn update_one(&self, query: Document, update: impl Into) -> Update { + pub fn update_one( + &self, + query: Document, + update: impl Into, + ) -> Update<'_> { self.async_collection.update_one(query, update) } } diff --git a/src/action/watch.rs b/src/action/watch.rs index df9cea910..2c613f8a0 100644 --- a/src/action/watch.rs +++ b/src/action/watch.rs @@ -54,7 +54,7 @@ impl Client { /// [`ClientSession`] has been provided. #[deeplink] #[options_doc(watch)] - pub fn watch(&self) -> Watch { + pub fn watch(&self) -> Watch<'_> { Watch::new_cluster(self) } } @@ -83,7 +83,7 @@ impl Database { /// [`ClientSession`] has been provided. #[deeplink] #[options_doc(watch)] - pub fn watch(&self) -> Watch { + pub fn watch(&self) -> Watch<'_> { Watch::new( self.client(), AggregateTarget::Database(self.name().to_string()), @@ -111,7 +111,7 @@ where /// [`ClientSession`] has been provided. #[deeplink] #[options_doc(watch)] - pub fn watch(&self) -> Watch { + pub fn watch(&self) -> Watch<'_, T> { Watch::new(self.client(), self.namespace().into()) } } @@ -128,7 +128,7 @@ impl crate::sync::Client { /// Change streams require either a "majority" read concern or no read /// concern. Anything else will cause a server error. #[options_doc(watch, "run")] - pub fn watch(&self) -> Watch { + pub fn watch(&self) -> Watch<'_> { self.async_client.watch() } } @@ -145,7 +145,7 @@ impl crate::sync::Database { /// Change streams require either a "majority" read concern or no read /// concern. Anything else will cause a server error. #[options_doc(watch, "run")] - pub fn watch(&self) -> Watch { + pub fn watch(&self) -> Watch<'_> { self.async_database.watch() } } @@ -166,7 +166,7 @@ where /// Change streams require either a "majority" read concern or no read concern. Anything else /// will cause a server error. #[options_doc(watch, "run")] - pub fn watch(&self) -> Watch { + pub fn watch(&self) -> Watch<'_, T> { self.async_collection.watch() } } diff --git a/src/event/sdam/topology_description.rs b/src/event/sdam/topology_description.rs index f107c8346..949042bff 100644 --- a/src/event/sdam/topology_description.rs +++ b/src/event/sdam/topology_description.rs @@ -82,7 +82,7 @@ impl TopologyDescription { } /// Gets the servers in the topology. - pub fn servers(&self) -> HashMap<&ServerAddress, ServerInfo> { + pub fn servers(&self) -> HashMap<&ServerAddress, ServerInfo<'_>> { self.description .servers .iter() diff --git a/src/hello.rs b/src/hello.rs index b070b8db1..f57268450 100644 --- a/src/hello.rs +++ b/src/hello.rs @@ -8,7 +8,7 @@ use serde::{Deserialize, Serialize}; use tokio::sync::broadcast; use crate::{ - bson::{doc, oid::ObjectId, DateTime, Document, Timestamp}, + bson::{doc, oid::ObjectId, DateTime, Document}, client::{ options::{ServerAddress, ServerApi}, ClusterTime, @@ -232,9 +232,3 @@ impl HelloCommandResponse { pub(crate) struct LastWrite { pub last_write_date: DateTime, } - -#[derive(Debug, Clone, PartialEq, Deserialize)] -pub(crate) struct OpTime { - ts: Timestamp, - t: i32, -} diff --git a/src/sdam/topology.rs b/src/sdam/topology.rs index dea99058d..043cf5a48 100644 --- a/src/sdam/topology.rs +++ b/src/sdam/topology.rs @@ -146,7 +146,7 @@ impl Topology { } #[cfg(any(feature = "tracing-unstable", test))] - pub(crate) fn latest(&self) -> Ref { + pub(crate) fn latest(&self) -> Ref<'_, TopologyState> { self.watcher.peek_latest() } } @@ -933,7 +933,7 @@ impl TopologyWatcher { /// Note: this method holds a read lock on the state, so it is best if the borrow is /// short-lived. For longer use-cases, clone the `TopologyState` or use `observe_latest` /// instead. - pub(crate) fn peek_latest(&self) -> Ref { + pub(crate) fn peek_latest(&self) -> Ref<'_, TopologyState> { self.receiver.borrow() } diff --git a/src/test/spec/unified_runner/test_file.rs b/src/test/spec/unified_runner/test_file.rs index 95af36708..048ed364c 100644 --- a/src/test/spec/unified_runner/test_file.rs +++ b/src/test/spec/unified_runner/test_file.rs @@ -510,13 +510,6 @@ impl ExpectedEventType { } } -#[derive(Debug, Copy, Clone, PartialEq, Eq, Deserialize)] -#[serde(rename_all = "camelCase", deny_unknown_fields)] -pub(crate) enum EventMatch { - Exact, - Prefix, -} - #[cfg(feature = "tracing-unstable")] #[derive(Debug, Deserialize)] #[serde(deny_unknown_fields, rename_all = "camelCase")] diff --git a/src/test/util/trace.rs b/src/test/util/trace.rs index 904954906..037e8586f 100644 --- a/src/test/util/trace.rs +++ b/src/test/util/trace.rs @@ -129,14 +129,14 @@ impl TracingHandler { /// [`TracingLevelsGuard`] which, when dropped, will clear the levels set on this handler. /// This can be used to temporarily configure the levels on the global default handler for /// the duration of a test. - pub(crate) fn set_levels(&self, new_levels: HashMap) -> TracingLevelsGuard { + pub(crate) fn set_levels(&self, new_levels: HashMap) -> TracingLevelsGuard<'_> { let mut levels = self.levels.write().unwrap(); *levels = new_levels; TracingLevelsGuard { handler: self } } /// Returns an `EventStream` that will yield events received by this handler. - pub(crate) fn event_stream(&self) -> EventStream { + pub(crate) fn event_stream(&self) -> EventStream<'_, TracingEvent> { self.buffer.stream() } } @@ -259,7 +259,7 @@ struct TracingEventVisitor<'a> { } impl TracingEventVisitor<'_> { - fn new(event: &mut TracingEvent) -> TracingEventVisitor { + fn new(event: &mut TracingEvent) -> TracingEventVisitor<'_> { TracingEventVisitor { event } } } diff --git a/tests/readme_examples.rs b/tests/readme_examples.rs index 3740d6811..668dc932e 100644 --- a/tests/readme_examples.rs +++ b/tests/readme_examples.rs @@ -63,6 +63,7 @@ async fn _inserting_documents_into_a_collection(db: mongodb::Database) -> Result use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] +#[allow(unused)] struct Book { title: String, author: String,