@@ -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`
@@ -2333,4 +2333,14 @@ mod tests {
23332333 let unboxed = boxed. into_buf ( ) ;
23342334 assert_eq ! ( subjectal, unboxed) ;
23352335 }
2336+
2337+ #[ test]
2338+ fn default_lifetime_is_correct ( ) {
2339+ // if this compiles, we're good
2340+ fn or_default ( ptr : & Pointer ) -> & Pointer {
2341+ Some ( ptr) . unwrap_or_default ( )
2342+ }
2343+ // just to satisfy codecov and clippy
2344+ or_default ( Pointer :: root ( ) ) ;
2345+ }
23362346}
0 commit comments