aboutsummaryrefslogtreecommitdiffstats
path: root/components/deny_public_fields
diff options
context:
space:
mode:
authorHarvey Hunt <harveyhuntnexus@gmail.com>2017-06-24 00:21:52 +0100
committerHarvey Hunt <harveyhuntnexus@gmail.com>2017-06-25 18:12:43 +0100
commit6081241962476ccb7f85dfa251977ecf88f047d7 (patch)
treee63da696ab592962dcb580b8fa9500d83732e293 /components/deny_public_fields
parent946c9aede12b19bab11f7f25db68f18c19c5b4a2 (diff)
downloadservo-6081241962476ccb7f85dfa251977ecf88f047d7.tar.gz
servo-6081241962476ccb7f85dfa251977ecf88f047d7.zip
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.
Diffstat (limited to 'components/deny_public_fields')
-rw-r--r--components/deny_public_fields/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/components/deny_public_fields/lib.rs b/components/deny_public_fields/lib.rs
index a43db51e4af..e9b8b7938a2 100644
--- a/components/deny_public_fields/lib.rs
+++ b/components/deny_public_fields/lib.rs
@@ -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()
});