mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
deny_public_fields: display field identifier in help message
Use a binding's field identifier to produce more descriptive output. Fall back to a binding's identifier if a field identifier is not available. Additionally, make the privatize.rs compiletest more specific and wrap the identifier in backticks to aid readability.
This commit is contained in:
parent
946c9aede1
commit
6081241962
2 changed files with 3 additions and 1 deletions
|
@ -17,7 +17,8 @@ fn expand_string(input: &str) -> String {
|
|||
let style = synstructure::BindStyle::Ref.into();
|
||||
synstructure::each_field(&type_, &style, |binding| {
|
||||
if binding.field.vis != syn::Visibility::Inherited {
|
||||
panic!("Field {} should not be public", binding.ident);
|
||||
panic!("Field `{}` should not be public",
|
||||
binding.field.ident.as_ref().unwrap_or(&binding.ident));
|
||||
}
|
||||
"".to_owned()
|
||||
});
|
||||
|
|
|
@ -9,6 +9,7 @@ extern crate deny_public_fields;
|
|||
|
||||
#[derive(DenyPublicFields)]
|
||||
//~^ ERROR proc-macro derive panicked
|
||||
//~| HELP Field `v1` should not be public
|
||||
struct Foo {
|
||||
pub v1: i32,
|
||||
v2: i32
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue