Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do we want to restrict code block nesting? #134

Open
sophokles73 opened this issue Jul 2, 2024 · 4 comments
Open

Do we want to restrict code block nesting? #134

sophokles73 opened this issue Jul 2, 2024 · 4 comments

Comments

@sophokles73
Copy link
Contributor

Clippy supports enforcing a maximum nesting depth for code blocks.

By default, this lint is not active. Based on a recent code review, I wonder if we want to set an upper limit for the nesting depth?

@PLeVasseur @AnotherDaniel @evshary Any thoughts?

@evshary
Copy link
Contributor

evshary commented Jul 2, 2024

I prefer to leave the liberty to developers because sometimes it might be inconvenient to limit the nesting depth.
However, it's still fine for me if we decide to enable the lint rule.

@AnotherDaniel
Copy link
Contributor

I feel there is no single absolute hard value for maximum nesting depth - "too much" can depend on context.

We might play around with this feature, see what the actual maximum in the code base is - and then decide if/where to fix this lint?

@PLeVasseur
Copy link
Contributor

Nice find @sophokles73. Perhaps we could take @AnotherDaniel's idea and then see how it goes for a few weeks or so and revisit?

For me, I find that lint rules can help prevent lots of little nits like I left on Kai's PR, since they will just not exist.

@sophokles73
Copy link
Contributor Author

I prefer to leave the liberty to developers because sometimes it might be inconvenient to limit the nesting depth. However, it's still fine for me if we decide to enable the lint rule.

I guess in such a case you could still add an #[allow] attribute to disable the check ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants