Warning for immediately called anonymous functions
Author: ankddevCreated Sep 1, 2026Updated Sep 29, 2026
Labelshelp wantedgood first issue
For example,
pub fn main() {
echo fn(a, b) {
a + b
}(1, 2)
}This code is roughly equivalent to:
pub fn main() {
echo {
let a = 1
let b = 2
a + b
}
}and to:
pub fn main() {
let a = 1
let b = 2
echo a + b
}But has calling overhead, thus I think that warning about it's redundancy would be good. There could also be a code action rewriting in. Related to https://github.com/gleam-lang/gleam/issues/6258.
Source: gleam-lang/gleam