如果我有未使用的变量,如何才能得到scalac来告诉我? [英] How can I get scalac to tell me if I have unused variables?

查看:70
本文介绍了如果我有未使用的变量,如何才能得到scalac来告诉我?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是注意到代码中的一个错误,即我创建了一个新变量,但后来却未能真正使用它.

I just noticed a bug in my code where I created a new variable, but then failed to actually use it.

我以为scalac会告诉我我的新变量尚未使用,但事实并非如此,经过一番谷歌搜索/手册页后,我找不到有关启用警告的任何信息.

I assumed that scalac would have told me that my new variable was unused, but this didn't seem to be the case, and after a small amount of googling / man page, I couldn't find anything about enabling warnings.

如何启用此类警告?

推荐答案

讨论的结果:这样做是IDE的一项沉思任务(到目前为止,他们并没有或至少不是很详尽)

Result of the discussion: It's considererd task of IDE to do that (so far they don't or at least not very exhaustive)

主要争论似乎是因为scala编译器的速度慢而受到批评,因此在顶部添加更多内容可能不是一个好主意.

The main argument seems to be that the scala compiler is already criticised for being slow, so it might not be a good idea to add even more stuff on top.

这篇关于如果我有未使用的变量,如何才能得到scalac来告诉我?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆