Skip to content

Mutable expressions should be on one line #2280

@Thorium

Description

@Thorium

F# Style-guide says:

Formatting mutation expressions

Mutation expressions location <- expr are normally formatted on one line.

So this is the correct style:

let test x =
   if x.IsNone then 
       x.Value <- "a"
   ()

The mutation is so untypical and notable action, that it should not be hidden, it should be always bring into attention of the person reading the code. But Fantomas dumps the <- arrow some times to same line as pre-conditions, e.g.:

let test x =
    if x.IsNone then x.Value <- "a"
    ()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions