@@ -88,7 +88,7 @@ pub async fn inspect<Fut, F>(future: Fut, f: F) -> Fut::Output
88
88
89
89
#[ cfg( test) ]
90
90
mod tests {
91
- use futures:: { future , executor} ;
91
+ use futures:: executor;
92
92
use crate :: future:: * ;
93
93
94
94
#[ test]
@@ -102,7 +102,7 @@ mod tests {
102
102
#[ test]
103
103
fn test_map ( ) {
104
104
executor:: block_on ( async {
105
- let future = future :: ready ( 1 ) ;
105
+ let future = ready ( 1 ) ;
106
106
let new_future = map ( future, |x| x + 3 ) ;
107
107
assert_eq ! ( await !( new_future) , 4 ) ;
108
108
} ) ;
@@ -111,34 +111,34 @@ mod tests {
111
111
#[ test]
112
112
fn test_then ( ) {
113
113
executor:: block_on ( async {
114
- let future = future :: ready ( 1 ) ;
115
- let new_future = then ( future, |x| future :: ready ( x + 3 ) ) ;
114
+ let future = ready ( 1 ) ;
115
+ let new_future = then ( future, |x| ready ( x + 3 ) ) ;
116
116
assert_eq ! ( await !( new_future) , 4 ) ;
117
117
} ) ;
118
118
}
119
119
120
120
#[ test]
121
121
fn test_and_then ( ) {
122
122
executor:: block_on ( async {
123
- let future = future :: ready ( Ok :: < i32 , i32 > ( 1 ) ) ;
124
- let new_future = and_then ( future, |x| future :: ready ( Ok :: < i32 , i32 > ( x + 3 ) ) ) ;
123
+ let future = ready ( Ok :: < i32 , i32 > ( 1 ) ) ;
124
+ let new_future = and_then ( future, |x| ready ( Ok :: < i32 , i32 > ( x + 3 ) ) ) ;
125
125
assert_eq ! ( await !( new_future) , Ok ( 4 ) ) ;
126
126
} ) ;
127
127
}
128
128
129
129
#[ test]
130
130
fn test_or_else ( ) {
131
131
executor:: block_on ( async {
132
- let future = future :: ready ( Err :: < i32 , i32 > ( 1 ) ) ;
133
- let new_future = or_else ( future, |x| future :: ready ( Err :: < i32 , i32 > ( x + 3 ) ) ) ;
132
+ let future = ready ( Err :: < i32 , i32 > ( 1 ) ) ;
133
+ let new_future = or_else ( future, |x| ready ( Err :: < i32 , i32 > ( x + 3 ) ) ) ;
134
134
assert_eq ! ( await !( new_future) , Err ( 4 ) ) ;
135
135
} ) ;
136
136
}
137
137
138
138
#[ test]
139
139
fn test_map_ok ( ) {
140
140
executor:: block_on ( async {
141
- let future = future :: ready ( Ok :: < i32 , i32 > ( 1 ) ) ;
141
+ let future = ready ( Ok :: < i32 , i32 > ( 1 ) ) ;
142
142
let new_future = map_ok ( future, |x| x + 3 ) ;
143
143
assert_eq ! ( await !( new_future) , Ok ( 4 ) ) ;
144
144
} ) ;
@@ -147,7 +147,7 @@ mod tests {
147
147
#[ test]
148
148
fn test_map_err ( ) {
149
149
executor:: block_on ( async {
150
- let future = future :: ready ( Err :: < i32 , i32 > ( 1 ) ) ;
150
+ let future = ready ( Err :: < i32 , i32 > ( 1 ) ) ;
151
151
let new_future = map_err ( future, |x| x + 3 ) ;
152
152
assert_eq ! ( await !( new_future) , Err ( 4 ) ) ;
153
153
} ) ;
@@ -156,7 +156,7 @@ mod tests {
156
156
#[ test]
157
157
fn test_flatten ( ) {
158
158
executor:: block_on ( async {
159
- let nested_future = future :: ready ( future :: ready ( 1 ) ) ;
159
+ let nested_future = ready ( ready ( 1 ) ) ;
160
160
let future = flatten ( nested_future) ;
161
161
assert_eq ! ( await !( future) , 1 ) ;
162
162
} ) ;
@@ -165,7 +165,7 @@ mod tests {
165
165
#[ test]
166
166
fn test_inspect ( ) {
167
167
executor:: block_on ( async {
168
- let future = future :: ready ( 1 ) ;
168
+ let future = ready ( 1 ) ;
169
169
let new_future = inspect ( future, |& x| assert_eq ! ( x, 1 ) ) ;
170
170
assert_eq ! ( await !( new_future) , 1 ) ;
171
171
} ) ;
0 commit comments