# RAN015 CancelPrevious with a body that ignores its token

`hint RAN015`: *This async memo's body ignores its CancellationToken, so `CancelPrevious` cancels nothing and acts as
`KeepLatest`.*

**Cause.** `createAsyncWithPolicy CancelPrevious` cancels the token of a superseded flight. A body that never reads the
token runs every flight to the end, so the policy acts as `KeepLatest`. The rule reports a literal `CancelPrevious`
policy whose compute names its token `_` or never uses it.

**Fix.** Pass the token to the awaited work, or use `KeepLatest`.

### Triggers

```fsharp
module Example

open System.Threading.Tasks
open Ranvier

let search () =
    createAsyncWithPolicy FlightPolicy.CancelPrevious (fun _ _ -> Task.Delay(100).ContinueWith (fun _ -> 1))
```

### Fixed

```fsharp
module Example

open System.Threading.Tasks
open Ranvier

let search () =
    createAsyncWithPolicy FlightPolicy.CancelPrevious (fun _ token -> Task.Delay(100, token).ContinueWith (fun _ -> 1))
```

**Suppression.** `// fsharpanalyzer: ignore-line RAN015`, with the reason on the line before.
