Skip to content

Commit 23740cd

Browse files
committed
formatting
1 parent 3fa4689 commit 23740cd

File tree

17 files changed

+115
-39
lines changed

17 files changed

+115
-39
lines changed

src/FsToolkit.ErrorHandling.JobResult/JobOptionCE.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ module JobOptionCE =
8888
let mutable doContinue = true
8989
let mutable result = Some()
9090

91-
while doContinue && guard () do
91+
while doContinue
92+
&& guard () do
9293
match! computation with
9394
| Some () -> ()
9495
| None ->

src/FsToolkit.ErrorHandling.JobResult/JobResultCE.fs

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,26 @@ module JobResultCE =
8080
) : Job<Result<'U, 'TError>> =
8181
job.Using(resource, binder)
8282

83-
member this.While(guard: unit -> bool, computation: Job<Result<unit, 'TError>>) : Job<Result<unit, 'TError>> = job {
84-
let mutable doContinue = true
85-
let mutable result = Ok()
83+
member this.While
84+
(
85+
guard: unit -> bool,
86+
computation: Job<Result<unit, 'TError>>
87+
) : Job<Result<unit, 'TError>> =
88+
job {
89+
let mutable doContinue = true
90+
let mutable result = Ok()
8691

87-
while doContinue && guard () do
88-
match! computation with
89-
| Ok () -> ()
90-
| Error e ->
91-
doContinue <- false
92-
result <- Error e
92+
while doContinue
93+
&& guard () do
94+
match! computation with
95+
| Ok () -> ()
96+
| Error e ->
97+
doContinue <- false
98+
result <- Error e
9399

94-
return result
100+
return result
95101

96-
}
102+
}
97103

98104
member inline this.For
99105
(

src/FsToolkit.ErrorHandling/OptionCE.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ module OptionCE =
7777
let mutable doContinue = true
7878
let mutable result = Some()
7979

80-
while doContinue && guard () do
80+
while doContinue
81+
&& guard () do
8182
match generator () with
8283
| Some () -> ()
8384
| None ->

src/FsToolkit.ErrorHandling/ResultCE.fs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,8 @@ module ResultCE =
7878
let mutable doContinue = true
7979
let mutable result = Ok()
8080

81-
while doContinue && guard () do
81+
while doContinue
82+
&& guard () do
8283
match generator () with
8384
| Ok () -> ()
8485
| Error e ->
@@ -94,7 +95,11 @@ module ResultCE =
9495
) : Result<unit, 'TError> =
9596
this.Using(
9697
sequence.GetEnumerator(),
97-
fun enum -> this.While((fun () -> enum.MoveNext()), this.Delay(fun () -> binder enum.Current))
98+
fun enum ->
99+
this.While(
100+
(fun () -> enum.MoveNext()),
101+
this.Delay(fun () -> binder enum.Current)
102+
)
98103
)
99104

100105
member inline _.BindReturn

src/FsToolkit.ErrorHandling/ValidationCE.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ module ValidationCE =
7777
let mutable doContinue = true
7878
let mutable result = Ok()
7979

80-
while doContinue && guard () do
80+
while doContinue
81+
&& guard () do
8182
match generator () with
8283
| Ok () -> ()
8384
| Error e ->

src/FsToolkit.ErrorHandling/ValueOptionCE.fs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ module ValueOptionCE =
7676
let mutable doContinue = true
7777
let mutable result = ValueSome()
7878

79-
while doContinue && guard () do
79+
while doContinue
80+
&& guard () do
8081
match generator () with
8182
| ValueSome () -> ()
8283
| ValueNone ->

tests/FsToolkit.ErrorHandling.JobResult.Tests/JobOptionCE.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,10 @@ let ceTests =
227227
Expect.equal actual (Some data) "Should be ok"
228228
}
229229
yield! [
230-
let maxIndices = [ 10; 1000000 ]
230+
let maxIndices = [
231+
10
232+
1000000
233+
]
231234

232235
for maxIndex in maxIndices do
233236
testCaseJob
@@ -272,7 +275,10 @@ let ceTests =
272275
let! actual = jobOption {
273276
while loopCount < data.Length do
274277
let! x = data.[loopCount]
275-
loopCount <- loopCount + 1
278+
279+
loopCount <-
280+
loopCount
281+
+ 1
276282

277283
return sideEffect ()
278284
}

tests/FsToolkit.ErrorHandling.JobResult.Tests/JobResultCE.fs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,10 @@ let ``JobResultCE using Tests`` =
290290
let ``JobResultCE loop Tests`` =
291291
testList "JobResultCE loop Tests" [
292292
yield! [
293-
let maxIndices = [ 10; 1000000 ]
293+
let maxIndices = [
294+
10
295+
1000000
296+
]
294297

295298
for maxIndex in maxIndices do
296299
testCaseJob
@@ -335,7 +338,10 @@ let ``JobResultCE loop Tests`` =
335338
let! actual = jobResult {
336339
while loopCount < data.Length do
337340
let! x = data.[loopCount]
338-
loopCount <- loopCount + 1
341+
342+
loopCount <-
343+
loopCount
344+
+ 1
339345

340346
return sideEffect ()
341347
}

tests/FsToolkit.ErrorHandling.TaskResult.Tests/BackgroundTaskResultCE.fs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,10 @@ let ``BackgroundTaskResultCE using Tests`` =
349349
let ``BackgroundTaskResultCE loop Tests`` =
350350
testList "BackgroundTaskResultCE loop Tests" [
351351
yield! [
352-
let maxIndices = [ 10; 1000000 ]
352+
let maxIndices = [
353+
10
354+
1000000
355+
]
353356

354357
for maxIndex in maxIndices do
355358
testCaseTask

tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskOptionCE.fs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,10 @@ let ceTests =
282282
Expect.equal actual (Some data) "Should be ok"
283283
}
284284
yield! [
285-
let maxIndices = [ 10; 1000000 ]
285+
let maxIndices = [
286+
10
287+
1000000
288+
]
286289

287290
for maxIndex in maxIndices do
288291
testCaseTask
@@ -321,7 +324,12 @@ let ceTests =
321324
return index
322325
}
323326

324-
Expect.equal index (items.Length - 1) "Index should reach maxIndex"
327+
Expect.equal
328+
index
329+
(items.Length
330+
- 1)
331+
"Index should reach maxIndex"
332+
325333
Expect.equal actual (None) "Should be NOPE"
326334
}
327335
testCaseTask "while fail"

0 commit comments

Comments
 (0)