From 2775f75f8292cd1396e236f86e598b2b57fb2362 Mon Sep 17 00:00:00 2001 From: Tobias Bucher Date: Mon, 17 Mar 2014 01:44:02 +0100 Subject: [PATCH] Allow capital L as variable name When the lint uppercase_variables is disallowed/warned about/denied, an uppercase L (ell) should be still allowed as its lowercase variant is too similar to an uppercase i or an 1 (one). --- src/librustc/middle/lint.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index 9a6ea297af096..782a0e320a11c 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -1208,7 +1208,7 @@ fn check_pat_uppercase_variable(cx: &Context, p: &ast::Pat) { // last identifier alone is right choice for this lint. let ident = path.segments.last().unwrap().identifier; let s = token::get_ident(ident); - if s.get().char_at(0).is_uppercase() { + if s.get().char_at(0).is_uppercase() && s.get() != "L" { cx.span_lint( UppercaseVariables, path.span, @@ -1227,7 +1227,7 @@ fn check_struct_uppercase_variable(cx: &Context, s: &ast::StructDef) { match sf.node { ast::StructField_ { kind: ast::NamedField(ident, _), .. } => { let s = token::get_ident(ident); - if s.get().char_at(0).is_uppercase() { + if s.get().char_at(0).is_uppercase() && s.get() != "L" { cx.span_lint( UppercaseVariables, sf.span,