2
0
Fork 0
mirror of https://github.com/rust-lang/rust-analyzer synced 2025-02-13 20:48:33 +00:00

Auto merge of - danieleades:static-mod-depth-limit, r=lnicola

interior-mutable types should be 'static' rather than 'const

with the 'tracking' feature enabled, `limit::Limit` is interior mutable, so the `const` `hir_def::nameres::mod_resolution::MOD_DEPTH_LIMIT` is probably meant to be `static` rather than `const`.

with `const` you get a new copy of it everywhere it's used, instead of the shared, global value that seems to be the intent.

This fix brought to you by the catchily-named `clippy::declare_interior_mutable_const` lint.
This commit is contained in:
bors 2023-01-12 10:58:19 +00:00
commit 80e616e00b

View file

@ -7,7 +7,7 @@ use syntax::SmolStr;
use crate::{db::DefDatabase, HirFileId};
const MOD_DEPTH_LIMIT: Limit = Limit::new(32);
static MOD_DEPTH_LIMIT: Limit = Limit::new(32);
#[derive(Clone, Debug)]
pub(super) struct ModDir {