Skip to content

Commit 697afce

Browse files
committed
formatted docs stderr | missing_debug_impls.rs
1 parent 1c765d6 commit 697afce

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

tests/ui/lint/missing-debug-implementations-lint.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
//! Test the `missing_debug_implementations` lint that warns about public types without Debug.
2+
//!
3+
//! This lint helps enforce the convention that public types should implement Debug
4+
//! for better debugging experience, as recommended by RFC 504.
5+
//!
6+
//! See https://github.com/rust-lang/rust/issues/20855
7+
18
//@ compile-flags: --crate-type lib
29
#![deny(missing_debug_implementations)]
310
#![allow(unused)]
@@ -10,7 +17,6 @@ pub enum A {} //~ ERROR type does not implement `Debug`
1017
pub enum B {}
1118

1219
pub enum C {}
13-
1420
impl fmt::Debug for C {
1521
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
1622
Ok(())
@@ -23,15 +29,14 @@ pub struct Foo; //~ ERROR type does not implement `Debug`
2329
pub struct Bar;
2430

2531
pub struct Baz;
26-
2732
impl fmt::Debug for Baz {
2833
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
2934
Ok(())
3035
}
3136
}
3237

38+
// Private types should not trigger the lint
3339
struct PrivateStruct;
34-
3540
enum PrivateEnum {}
3641

3742
#[derive(Debug)]

tests/ui/lint/missing-debug-implementations-lint.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
error: type does not implement `Debug`; consider adding `#[derive(Debug)]` or a manual implementation
2-
--> $DIR/missing_debug_impls.rs:7:1
2+
--> $DIR/missing-debug-implementations-lint.rs:11:1
33
|
44
LL | pub enum A {}
55
| ^^^^^^^^^^^^^
66
|
77
note: the lint level is defined here
8-
--> $DIR/missing_debug_impls.rs:2:9
8+
--> $DIR/missing-debug-implementations-lint.rs:6:9
99
|
1010
LL | #![deny(missing_debug_implementations)]
1111
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1212

1313
error: type does not implement `Debug`; consider adding `#[derive(Debug)]` or a manual implementation
14-
--> $DIR/missing_debug_impls.rs:20:1
14+
--> $DIR/missing-debug-implementations-lint.rs:23:1
1515
|
1616
LL | pub struct Foo;
1717
| ^^^^^^^^^^^^^^^

0 commit comments

Comments
 (0)