fredrikekre / Runic.jl

A code formatter for Julia with rules set in stone.
MIT License
103 stars 3 forks source link

Adds false return || (edit: update before filing an issue) #75

Closed NilsWildt closed 2 weeks ago

NilsWildt commented 2 weeks ago

In

for i in 1:10
        with_logger(logger) do
            @info "metrics" x = x
        end
end

as it becomes:

for i in 1:10
        with_logger(logger) do
            return @info "metrics" x = x
        end
end

It seems that Runic adds a return in front of the @info. I guess it's the with_() do end syntax?

fredrikekre commented 2 weeks ago

Hi, it isn't incorrect: it is the return of the anonymous function created by the do block. However, it became a bit "noisy" so I removed returns from do blocks in #70. You probably just need to update Runic.

NilsWildt commented 2 weeks ago

I see -- and indeed, had to update. Didn't think of my shared @ runic where it ran! Thank you.