How to disable keywords "as"

Hi all, actually I had some problems with the "as" keyword, and basically the challenges are this ones:

For example the keyword can truncate numbers when we move from i32 to i16 or similar, seems is something that being checked and maybe will be handled on the future, but while, I would like to disable the use of the "as" keyword on the project.

Does not have the "as" keyword is not a problem to me, use the TryFrom would be enough, but I can't found how to disable a keyword on Rust.

Would be ideal be able to disable a keyword like "as" also in the dependencies.

Thx!

You can't disable part of the language, but you can configure clippy to deny the as_conversions lint.

5 Likes

would be there to trigger on the deps or similar?

No, you can't lint dependencies, and trying to stop dependencies from using as does not strike me as a worthwhile goal.

1 Like

well, half-half, a warning can be very useful to check if "as" was properly used.

cargo clippy -vvv will print warnings for dependencies too.

4 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.