rename lint to unnameable-test-functions
This commit is contained in:
parent
6a2003e4e3
commit
51a0425f36
@ -1740,20 +1740,20 @@ impl EarlyLintPass for EllipsisInclusiveRangePatterns {
|
||||
}
|
||||
|
||||
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(..) => {
|
||||
@ -1765,7 +1765,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UntestableMethod {
|
||||
None => {}
|
||||
_ => {
|
||||
cx.struct_span_lint(
|
||||
UNTESTABLE_METHOD,
|
||||
UNNAMEABLE_TEST_FUNCTIONS,
|
||||
attr.span,
|
||||
"cannot test inner function",
|
||||
).emit();
|
||||
|
@ -130,7 +130,7 @@ pub fn register_builtins(store: &mut lint::LintStore, sess: Option<&Session>) {
|
||||
MutableTransmutes: MutableTransmutes,
|
||||
UnionsWithDropFields: UnionsWithDropFields,
|
||||
UnreachablePub: UnreachablePub,
|
||||
UntestableMethod: UntestableMethod,
|
||||
UnnameableTestFunctions: UnnameableTestFunctions,
|
||||
TypeAliasBounds: TypeAliasBounds,
|
||||
UnusedBrokenConst: UnusedBrokenConst,
|
||||
TrivialConstraints: TrivialConstraints,
|
||||
|
@ -8,11 +8,11 @@
|
||||
// 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();
|
||||
}
|
||||
@ -20,7 +20,7 @@ fn foo() {
|
||||
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();
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user