]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_lint/nonstandard_style.rs
handle errors based on parse_sess
[rust.git] / src / librustc_lint / nonstandard_style.rs
index 09871c0e84049d801888014eafc012a400faa67f..40781b0771d89d72a0161bb83ed933f54b21aeb2 100644 (file)
@@ -59,10 +59,10 @@ fn char_has_case(c: char) -> bool {
 
         fn is_camel_case(name: ast::Name) -> bool {
             let name = name.as_str();
+            let name = name.trim_matches('_');
             if name.is_empty() {
                 return true;
             }
-            let name = name.trim_matches('_');
 
             // start with a non-lowercase letter rather than non-uppercase
             // ones (some scripts don't have a concept of upper/lowercase)
@@ -121,7 +121,7 @@ fn check_item(&mut self, cx: &LateContext, it: &hir::Item) {
         let has_repr_c = it.attrs
             .iter()
             .any(|attr| {
-                attr::find_repr_attrs(cx.tcx.sess.diagnostic(), attr)
+                attr::find_repr_attrs(&cx.tcx.sess.parse_sess, attr)
                     .iter()
                     .any(|r| r == &attr::ReprC)
             });