Skip to content

Commit a41bcb3

Browse files
committed
clean up misc from retro-review of #101
1 parent cf16365 commit a41bcb3

File tree

4 files changed

+8
-17
lines changed

4 files changed

+8
-17
lines changed

src/delete.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! provided implementations (`"json"` & `"toml"`) operating as follows:
88
//! - If the [`Pointer`] can be resolved, then the [`Value`](`Delete::Value`) is
99
//! deleted and returned as `Some(value)`.
10-
//! - If the [`Pointer`] fails to resolve for any reason, `Ok(None)` is
10+
//! - If the [`Pointer`] fails to resolve for any reason, `None` is
1111
//! returned.
1212
//! - If the [`Pointer`] is root, `value` is replaced:
1313
//! - `"json"` - `serde_json::Value::Null`

src/diagnostic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pub struct Label {
3232

3333
impl Label {
3434
/// Creates a new instance of a [`Label`] from its parts
35-
pub fn new(text: String, offset: usize, len: usize) -> Self {
35+
pub(crate) fn new(text: String, offset: usize, len: usize) -> Self {
3636
Self { text, offset, len }
3737
}
3838
}

src/pointer.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,20 +1149,6 @@ impl core::fmt::Display for PointerBuf {
11491149
}
11501150
}
11511151

1152-
/// Indicates that a [`Pointer`] was unable to be parsed due to not containing
1153-
/// a leading slash (`'/'`).
1154-
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
1155-
pub struct NoLeadingSlash;
1156-
1157-
impl fmt::Display for NoLeadingSlash {
1158-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
1159-
write!(
1160-
f,
1161-
"json pointer must start with a slash ('/') and is not empty"
1162-
)
1163-
}
1164-
}
1165-
11661152
/// Indicates that a `Pointer` was malformed and unable to be parsed.
11671153
#[derive(Debug, PartialEq)]
11681154
pub enum ParseError {
@@ -1359,6 +1345,11 @@ const fn validate(value: &str) -> Result<&str, ParseError> {
13591345
Ok(value)
13601346
}
13611347

1348+
/// Validates that a sequence of bytes is a valid RFC 6901 Pointer.
1349+
///
1350+
/// # Panics
1351+
///
1352+
/// Caller must ensure the sequence is non-empty, and that offset is in range.
13621353
const fn validate_bytes(bytes: &[u8], offset: usize) -> Result<(), ParseError> {
13631354
if bytes[0] != b'/' && offset == 0 {
13641355
return Err(ParseError::NoLeadingSlash);

src/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ pub trait ResolveMut {
7676
fn resolve_mut(&mut self, ptr: &Pointer) -> Result<&mut Self::Value, Self::Error>;
7777
}
7878

79-
// TODO: should ResolveError be deprecated?
8079
/// Alias for [`Error`].
80+
#[deprecated(since = "0.7.2", note = "renamed to `Error`")]
8181
pub type ResolveError = Error;
8282

8383
/// Indicates that the `Pointer` could not be resolved.

0 commit comments

Comments
 (0)