Skip to content

Commit

Permalink
rename lint to unnameable-test-functions
Browse files Browse the repository at this point in the history
  • Loading branch information
estebank committed Jun 27, 2018
1 parent 6a2003e commit 51a0425
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
14 changes: 7 additions & 7 deletions src/librustc_lint/builtin.rs
Expand Up @@ -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(..) => {
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_lint/lib.rs
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/lint/test-inner-fn.rs
Expand Up @@ -8,19 +8,19 @@
// 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();
}
Expand Down
6 changes: 3 additions & 3 deletions src/test/ui/lint/test-inner-fn.stderr
@@ -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
Expand Down

0 comments on commit 51a0425

Please sign in to comment.