Skip to content

RUST-781 Remove unwraps from examples #474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 7 additions & 8 deletions src/test/documentation_examples.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ macro_rules! run_on_each_doc {
}

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

// Start Example 1
collection
Expand Down Expand Up @@ -105,7 +105,7 @@ async fn insert_examples(collection: &Collection<Document>) -> Result<()> {
}

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

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

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

// Start Example 14
let docs = vec![
Expand Down Expand Up @@ -715,7 +715,7 @@ async fn query_array_embedded_documents_examples(collection: &Collection<Documen
}

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

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

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

// Start Example 51
let docs = vec![
Expand Down Expand Up @@ -1261,8 +1261,7 @@ async fn update_examples(collection: &Collection<Document>) -> Result<()> {
},
None,
)
.await
.unwrap();
.await?;
// End Example 54

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

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

// Start Example 55
let docs = vec![
Expand Down