@@ -36,7 +36,7 @@ mod slice;
3636#[ cfg_attr( not( doc) , repr( transparent) ) ]
3737pub struct Pointer ( str ) ;
3838
39- impl Default for & ' static Pointer {
39+ impl Default for & Pointer {
4040 fn default ( ) -> Self {
4141 Pointer :: root ( )
4242 }
@@ -398,7 +398,7 @@ impl Pointer {
398398 /// [`Delete`]. The supplied implementations (`"json"` & `"toml"`) operate
399399 /// as follows:
400400 /// - If the `Pointer` can be resolved, the `Value` is deleted and returned.
401- /// - If the `Pointer` fails to resolve for any reason, `Ok( None) ` is returned.
401+ /// - If the `Pointer` fails to resolve for any reason, `None` is returned.
402402 /// - If the `Pointer` is root, `value` is replaced:
403403 /// - `"json"`: `serde_json::Value::Null`
404404 /// - `"toml"`: `toml::Value::Table::Default`
@@ -2342,4 +2342,14 @@ mod tests {
23422342 let unboxed = boxed. into_buf ( ) ;
23432343 assert_eq ! ( subjectal, unboxed) ;
23442344 }
2345+
2346+ #[ test]
2347+ fn default_lifetime_is_correct ( ) {
2348+ // if this compiles, we're good
2349+ fn or_default ( ptr : & Pointer ) -> & Pointer {
2350+ Some ( ptr) . unwrap_or_default ( )
2351+ }
2352+ // just to satisfy codecov and clippy
2353+ or_default ( Pointer :: root ( ) ) ;
2354+ }
23452355}
0 commit comments