This repository was archived by the owner on Mar 11, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +3
-25
lines changed Expand file tree Collapse file tree 2 files changed +3
-25
lines changed Original file line number Diff line number Diff line change 1
1
#![ deny( missing_docs) ]
2
+ #![ forbid( unsafe_code) ]
2
3
3
4
//! An ERC20-like Token program for the Solana blockchain
4
5
Original file line number Diff line number Diff line change 4
4
//! This implementation mostly matches `std::option` except iterators since the iteration
5
5
//! trait requires returning `std::option::Option`
6
6
7
- use std:: pin:: Pin ;
8
7
use std:: {
9
- convert, hint , mem,
8
+ convert, mem,
10
9
ops:: { Deref , DerefMut } ,
11
10
} ;
12
11
@@ -151,28 +150,6 @@ impl<T> COption<T> {
151
150
}
152
151
}
153
152
154
- /// Converts from [`Pin`]`<&COption<T>>` to `COption<`[`Pin`]`<&T>>`.
155
- ///
156
- /// [`Pin`]: ../pin/struct.Pin.html
157
- #[ inline]
158
- #[ allow( clippy:: wrong_self_convention) ]
159
- pub fn as_pin_ref ( self : Pin < & Self > ) -> COption < Pin < & T > > {
160
- unsafe { Pin :: get_ref ( self ) . as_ref ( ) . map ( |x| Pin :: new_unchecked ( x) ) }
161
- }
162
-
163
- /// Converts from [`Pin`]`<&mut COption<T>>` to `COption<`[`Pin`]`<&mut T>>`.
164
- ///
165
- /// [`Pin`]: ../pin/struct.Pin.html
166
- #[ inline]
167
- #[ allow( clippy:: wrong_self_convention) ]
168
- pub fn as_pin_mut ( self : Pin < & mut Self > ) -> COption < Pin < & mut T > > {
169
- unsafe {
170
- Pin :: get_unchecked_mut ( self )
171
- . as_mut ( )
172
- . map ( |x| Pin :: new_unchecked ( x) )
173
- }
174
- }
175
-
176
153
/////////////////////////////////////////////////////////////////////////
177
154
// Getting to contained values
178
155
/////////////////////////////////////////////////////////////////////////
@@ -645,7 +622,7 @@ impl<T> COption<T> {
645
622
646
623
match * self {
647
624
COption :: Some ( ref mut v) => v,
648
- COption :: None => unsafe { hint :: unreachable_unchecked ( ) } ,
625
+ COption :: None => unreachable ! ( ) ,
649
626
}
650
627
}
651
628
You can’t perform that action at this time.
0 commit comments