Skip to content

Commit 1b643df

Browse files
authored
RUST-781 Remove unwraps from examples (#474)
1 parent 214ed2c commit 1b643df

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/test/documentation_examples.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ macro_rules! run_on_each_doc {
3434
}
3535

3636
async fn insert_examples(collection: &Collection<Document>) -> Result<()> {
37-
collection.drop(None).await.unwrap();
37+
collection.drop(None).await?;
3838

3939
// Start Example 1
4040
collection
@@ -105,7 +105,7 @@ async fn insert_examples(collection: &Collection<Document>) -> Result<()> {
105105
}
106106

107107
async fn query_top_level_fields_examples(collection: &Collection<Document>) -> Result<()> {
108-
collection.drop(None).await.unwrap();
108+
collection.drop(None).await?;
109109

110110
// Start Example 6
111111
let docs = vec![
@@ -250,7 +250,7 @@ async fn query_top_level_fields_examples(collection: &Collection<Document>) -> R
250250
}
251251

252252
async fn query_embedded_documents_examples(collection: &Collection<Document>) -> Result<()> {
253-
collection.drop(None).await.unwrap();
253+
collection.drop(None).await?;
254254

255255
// Start Example 14
256256
let docs = vec![
@@ -715,7 +715,7 @@ async fn query_array_embedded_documents_examples(collection: &Collection<Documen
715715
}
716716

717717
async fn query_null_or_missing_fields_examples(collection: &Collection<Document>) -> Result<()> {
718-
collection.drop(None).await.unwrap();
718+
collection.drop(None).await?;
719719

720720
// Start Example 38
721721
let docs = vec![
@@ -1058,7 +1058,7 @@ async fn projection_examples(collection: &Collection<Document>) -> Result<()> {
10581058
}
10591059

10601060
async fn update_examples(collection: &Collection<Document>) -> Result<()> {
1061-
collection.drop(None).await.unwrap();
1061+
collection.drop(None).await?;
10621062

10631063
// Start Example 51
10641064
let docs = vec![
@@ -1261,8 +1261,7 @@ async fn update_examples(collection: &Collection<Document>) -> Result<()> {
12611261
},
12621262
None,
12631263
)
1264-
.await
1265-
.unwrap();
1264+
.await?;
12661265
// End Example 54
12671266

12681267
run_on_each_doc!(
@@ -1286,7 +1285,7 @@ async fn update_examples(collection: &Collection<Document>) -> Result<()> {
12861285
}
12871286

12881287
async fn delete_examples(collection: &Collection<Document>) -> Result<()> {
1289-
collection.drop(None).await.unwrap();
1288+
collection.drop(None).await?;
12901289

12911290
// Start Example 55
12921291
let docs = vec![

0 commit comments

Comments
 (0)