Skip to content

Commit b86a65d

Browse files
committed
Limit style lint to non-synthetic generic params
1 parent a37126b commit b86a65d

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

Diff for: src/librustc_lint/bad_style.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCamelCaseTypes {
128128

129129
fn check_generic_param(&mut self, cx: &LateContext, param: &hir::GenericParam) {
130130
if let hir::GenericParam::Type(ref gen) = *param {
131-
self.check_case(cx, "type parameter", gen.name, gen.span);
131+
if gen.synthetic.is_none() {
132+
self.check_case(cx, "type parameter", gen.name, gen.span);
133+
}
132134
}
133135
}
134136
}

Diff for: src/test/run-pass/issue-46959.rs

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Copyright 2018 The Rust Project Developers. See the COPYRIGHT
2+
// file at the top-level directory of this distribution and at
3+
// http://rust-lang.org/COPYRIGHT.
4+
//
5+
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6+
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7+
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8+
// option. This file may not be copied, modified, or distributed
9+
// except according to those terms.
10+
11+
#![feature(universal_impl_trait)]
12+
#![feature(conservative_impl_trait)]
13+
#![deny(non_camel_case_types)]
14+
15+
#[allow(dead_code)]
16+
fn qqq(lol: impl Iterator<Item=u32>) -> impl Iterator<Item=u64> {
17+
lol.map(|x|x as u64)
18+
}
19+
20+
fn main() {}

0 commit comments

Comments
 (0)