}
declare_lint! {
- UNTESTABLE_METHOD,
+ UNNAMEABLE_TEST_FUNCTIONS,
Warn,
- "detects untestable method marked as #[test]"
+ "detects an function that cannot be named being marked as #[test]"
}
-pub struct UntestableMethod;
+pub struct UnnameableTestFunctions;
-impl LintPass for UntestableMethod {
+impl LintPass for UnnameableTestFunctions {
fn get_lints(&self) -> LintArray {
- lint_array!(UNTESTABLE_METHOD)
+ lint_array!(UNNAMEABLE_TEST_FUNCTIONS)
}
}
-impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UntestableMethod {
+impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnameableTestFunctions {
fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
match it.node {
hir::ItemFn(..) => {
None => {}
_ => {
cx.struct_span_lint(
- UNTESTABLE_METHOD,
+ UNNAMEABLE_TEST_FUNCTIONS,
attr.span,
"cannot test inner function",
).emit();
MutableTransmutes: MutableTransmutes,
UnionsWithDropFields: UnionsWithDropFields,
UnreachablePub: UnreachablePub,
- UntestableMethod: UntestableMethod,
+ UnnameableTestFunctions: UnnameableTestFunctions,
TypeAliasBounds: TypeAliasBounds,
UnusedBrokenConst: UnusedBrokenConst,
TrivialConstraints: TrivialConstraints,
// option. This file may not be copied, modified, or distributed
// except according to those terms.
-// compile-flags: --test -D untestable_method
+// compile-flags: --test -D unnameable_test_functions
#[test]
fn foo() {
- #[test] //~ ERROR cannot test inner function [untestable_method]
+ #[test] //~ ERROR cannot test inner function [unnameable_test_functions]
fn bar() {}
bar();
}
mod x {
#[test]
fn foo() {
- #[test] //~ ERROR cannot test inner function [untestable_method]
+ #[test] //~ ERROR cannot test inner function [unnameable_test_functions]
fn bar() {}
bar();
}
error: cannot test inner function
--> $DIR/test-inner-fn.rs:15:5
|
-LL | #[test] //~ ERROR cannot test inner function [untestable_method]
+LL | #[test] //~ ERROR cannot test inner function [unnameable_test_functions]
| ^^^^^^^
|
- = note: requested on the command line with `-D untestable-method`
+ = note: requested on the command line with `-D unnameable-test-functions`
error: cannot test inner function
--> $DIR/test-inner-fn.rs:23:9
|
-LL | #[test] //~ ERROR cannot test inner function [untestable_method]
+LL | #[test] //~ ERROR cannot test inner function [unnameable_test_functions]
| ^^^^^^^
error: aborting due to 2 previous errors