Skip to content

Commit

Permalink
chore: Fix analyze issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmah309 committed Dec 2, 2023
1 parent df52eef commit 70353fc
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/src/option/option.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sealed class Option<T extends Object> {
factory Option.$(_OptionEarlyReturnFunction<T> fn) {
try {
return fn(const _OptionEarlyReturnKey._());
} on _OptionEarlyReturnNotification catch (e) {
} on _OptionEarlyReturnNotification catch (_) {
return const None();
}
}
Expand Down
2 changes: 0 additions & 2 deletions lib/src/typedefs/infallible.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
import 'package:rust_core/result.dart';

/// The error type for errors that can never happen
typedef Infallible = Never;
8 changes: 4 additions & 4 deletions test/option/option_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -254,20 +254,20 @@ void main(){
});

group("Option Early Return",(){
Option<int> intSome() => Some(1);
Option<int> int3Some() => Some(1);
Option<int> intNone() => const None();

test('Do Notation No Exit', () {
Option<int> earlyReturn(int val) => Option.$(($){
int x = intSome()[$];
return Some(val + 3);
int x = int3Some()[$];
return Some(val + x);
});
expect(earlyReturn(2).unwrap(), 5);
});

test('Do Notation With Exit', () {
Option<int> earlyReturn(int val) => Option.$(($){
int x = intNone()[$];
int _ = intNone()[$];
return Some(val + 3);
});
expect(earlyReturn(2), const None());
Expand Down
3 changes: 3 additions & 0 deletions test/result/record_to_result_extension_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// ignore_for_file: prefer_typing_uninitialized_variables
// ignore_for_file: unused_local_variable

import 'package:rust_core/result.dart';
import 'package:test/test.dart';

Expand Down

0 comments on commit 70353fc

Please sign in to comment.