From 64610dd0a211a4704c7f2b32e61827cbf8bd9548 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 21 Nov 2023 17:25:01 +0100 Subject: [PATCH] fixup! API refactor to make it harder to ignore errors --- crates/apollo-compiler/CHANGELOG.md | 2 +- crates/apollo-compiler/src/validation/mod.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/apollo-compiler/CHANGELOG.md b/crates/apollo-compiler/CHANGELOG.md index b9214ea69..d0be3b112 100644 --- a/crates/apollo-compiler/CHANGELOG.md +++ b/crates/apollo-compiler/CHANGELOG.md @@ -31,7 +31,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm On success they return the schema or document (unmodified) wrapped in a `Valid<_>` marker type, which is **immutable**. - Change `ExecutableDocument` to require a `&Valid` instead of `&Schema`, - forcing callers to either run validation or opt out explicitly with `Valid::assert_valid`. + forcing callers to either run validation or opt out explicitly with `Valid::assume_valid`. - Make `parse_mixed` and `to_mixed` validate both the schema and document. Rename them with a `_validate` suffix. - Corresponding changes to all of the above in `Parser` method signatures diff --git a/crates/apollo-compiler/src/validation/mod.rs b/crates/apollo-compiler/src/validation/mod.rs index 0de24bee7..b32b2bad2 100644 --- a/crates/apollo-compiler/src/validation/mod.rs +++ b/crates/apollo-compiler/src/validation/mod.rs @@ -47,7 +47,7 @@ pub use crate::node::NodeLocation; /// * [`ExecutableDocument::parse_and_validate`] /// * [`ExecutableDocument::validate`] /// -/// … or by explicitly skipping it with [`Valid::assert_valid`]. +/// … or by explicitly skipping it with [`Valid::assume_valid`]. /// /// The schema or document inside `Valid` is immutable (`&mut T` is not given out). /// It can be extracted with [`into_inner`][Self::into_inner], @@ -62,7 +62,7 @@ impl Valid { /// the document is known through some other means to be valid. /// For example, if it was loaded from some external storag /// where it was only stored after validation. - pub fn assert_valid(document: T) -> Self { + pub fn assume_valid(document: T) -> Self { Self(document) }