File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed
Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## Unreleased
9+
10+ ### Changed
11+
12+ - Implementation of the ` Default ` trait for ` Pointer ` now doesn't constrain the lifetime.
13+
814## [ 0.7.1] 2025-02-16
915
1016### Changed
Original file line number Diff line number Diff line change @@ -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 }
@@ -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}
You can’t perform that action at this time.
0 commit comments