File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,17 +111,6 @@ func (o Optional[T]) HasValue() bool {
111111 return o .flavor == someFlavor
112112}
113113
114- // IsNone returns true if the Optional has no value.
115- // This is the case both for the zero value and for Optional values created with None().
116- // An Optional created with Default() or Some() is not None.
117- //
118- // Most callers only need [HasValue]. IsNone is useful when "not explicitly configured"
119- // (Default) and "explicitly disabled" (None) must be treated differently — for example,
120- // when a feature is enabled by default but can be explicitly turned off.
121- func (o Optional [T ]) IsNone () bool {
122- return o .flavor == noneFlavor
123- }
124-
125114// Get returns the value of the Optional.
126115// If the value is not present, it returns nil.
127116func (o * Optional [T ]) Get () * T {
Original file line number Diff line number Diff line change @@ -154,13 +154,6 @@ func TestNone(t *testing.T) {
154154 assert .Equal (t , & zeroVal , ret )
155155}
156156
157- func TestIsNone (t * testing.T ) {
158- assert .True (t , None [Sub ]().IsNone ())
159- assert .True (t , (Optional [Sub ]{}).IsNone ()) // zero value is None
160- assert .False (t , Some (Sub {}).IsNone ())
161- assert .False (t , Default (Sub {}).IsNone ())
162- }
163-
164157func ExampleNone () {
165158 type Person struct {
166159 Name string
You can’t perform that action at this time.
0 commit comments