# Should clippy warn about function calls outside closures if those are const? \[Answered\]

**URL:** <https://internals.rust-lang.org/t/should-clippy-warn-about-function-calls-outside-closures-if-those-are-const-answered/15452>\
**Category:** tools and infrastructure\
**Created:** [October 16, 2021, 2:56am UTC](https://internals.rust-lang.org/t/should-clippy-warn-about-function-calls-outside-closures-if-those-are-const-answered/15452 "2021-10-16T02:56:32Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![scottmcm](https://sea2.discourse-cdn.com/flex002/user_avatar/internals.rust-lang.org/scottmcm/32/2355_2.png) [@scottmcm](https://internals.rust-lang.org/u/scottmcm)\
**Post date:** [October 16, 2021, 9:50pm UTC](https://internals.rust-lang.org/t/should-clippy-warn-about-function-calls-outside-closures-if-those-are-const-answered/15452/4 "2021-10-16T21:50:27Z")

</div>

Hmm, raises an interesting API option. If there was a `const` such that one could say `.or_insert(Vec::EMPTY)` and because it's a `const` be confident that it's not a concern.

And it looks like if you do that, clippy is happy with it: [https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4cecdfcc136a38260852437de859b1d4](https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=4cecdfcc136a38260852437de859b1d4)

Looks like the `const` blocks that CAD97 mentioned also cause clippy to not warn for this: [https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=dc850d10fc9a205846c86b73f02ad60c](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=dc850d10fc9a205846c86b73f02ad60c)

---

_[View the full topic](https://internals.rust-lang.org/t/should-clippy-warn-about-function-calls-outside-closures-if-those-are-const-answered/15452)._
