Skip to content

Commit c687d70

Browse files
committed
Fix violations of non_camel_case_types
1 parent 9401707 commit c687d70

File tree

11 files changed

+171
-172
lines changed

11 files changed

+171
-172
lines changed

compiler/rustc_data_structures/src/stable_hasher.rs

+112-112
Large diffs are not rendered by default.

compiler/rustc_data_structures/src/sync.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@
2929
//! | `Lock<T>` | `RefCell<T>` | `RefCell<T>` or |
3030
//! | | | `parking_lot::Mutex<T>` |
3131
//! | `RwLock<T>` | `RefCell<T>` | `parking_lot::RwLock<T>` |
32-
//! | `MTLock<T>` [^1] | `T` | `Lock<T>` |
33-
//! | `MTLockRef<'a, T>` [^2] | `&'a mut MTLock<T>` | `&'a MTLock<T>` |
32+
//! | `MtLock<T>` [^1] | `T` | `Lock<T>` |
33+
//! | `MtLockRef<'a, T>` [^2] | `&'a mut MtLock<T>` | `&'a MtLock<T>` |
3434
//! | | | |
3535
//! | `ParallelIterator` | `Iterator` | `rayon::iter::ParallelIterator` |
3636
//!
37-
//! [^1] `MTLock` is similar to `Lock`, but the serial version avoids the cost
37+
//! [^1] `MtLock` is similar to `Lock`, but the serial version avoids the cost
3838
//! of a `RefCell`. This is appropriate when interior mutability is not
3939
//! required.
4040
//!
41-
//! [^2] `MTLockRef` is a typedef.
41+
//! [^2] `MtLockRef` is a typedef.
4242
4343
pub use crate::marker::*;
4444
use std::collections::HashMap;
@@ -212,15 +212,15 @@ cfg_if! {
212212

213213
use std::cell::RefCell as InnerRwLock;
214214

215-
pub type MTLockRef<'a, T> = &'a mut MTLock<T>;
215+
pub type MtLockRef<'a, T> = &'a mut MtLock<T>;
216216

217217
#[derive(Debug, Default)]
218-
pub struct MTLock<T>(T);
218+
pub struct MtLock<T>(T);
219219

220-
impl<T> MTLock<T> {
220+
impl<T> MtLock<T> {
221221
#[inline(always)]
222222
pub fn new(inner: T) -> Self {
223-
MTLock(inner)
223+
MtLock(inner)
224224
}
225225

226226
#[inline(always)]
@@ -245,10 +245,10 @@ cfg_if! {
245245
}
246246

247247
// FIXME: Probably a bad idea (in the threaded case)
248-
impl<T: Clone> Clone for MTLock<T> {
248+
impl<T: Clone> Clone for MtLock<T> {
249249
#[inline]
250250
fn clone(&self) -> Self {
251-
MTLock(self.0.clone())
251+
MtLock(self.0.clone())
252252
}
253253
}
254254
} else {
@@ -269,15 +269,15 @@ cfg_if! {
269269
pub use std::sync::Arc as Lrc;
270270
pub use std::sync::Weak as Weak;
271271

272-
pub type MTLockRef<'a, T> = &'a MTLock<T>;
272+
pub type MtLockRef<'a, T> = &'a MtLock<T>;
273273

274274
#[derive(Debug, Default)]
275-
pub struct MTLock<T>(Lock<T>);
275+
pub struct MtLock<T>(Lock<T>);
276276

277-
impl<T> MTLock<T> {
277+
impl<T> MtLock<T> {
278278
#[inline(always)]
279279
pub fn new(inner: T) -> Self {
280-
MTLock(Lock::new(inner))
280+
MtLock(Lock::new(inner))
281281
}
282282

283283
#[inline(always)]

compiler/rustc_monomorphize/src/collector.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
//! regardless of whether it is actually needed or not.
166166
167167
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
168-
use rustc_data_structures::sync::{par_for_each_in, MTLock, MTLockRef};
168+
use rustc_data_structures::sync::{par_for_each_in, MtLock, MtLockRef};
169169
use rustc_hir as hir;
170170
use rustc_hir::def::DefKind;
171171
use rustc_hir::def_id::{DefId, DefIdMap, LocalDefId};
@@ -263,13 +263,13 @@ pub fn collect_crate_mono_items(
263263

264264
debug!("building mono item graph, beginning at roots");
265265

266-
let mut visited = MTLock::new(FxHashSet::default());
267-
let mut usage_map = MTLock::new(UsageMap::new());
266+
let mut visited = MtLock::new(FxHashSet::default());
267+
let mut usage_map = MtLock::new(UsageMap::new());
268268
let recursion_limit = tcx.recursion_limit();
269269

270270
{
271-
let visited: MTLockRef<'_, _> = &mut visited;
272-
let usage_map: MTLockRef<'_, _> = &mut usage_map;
271+
let visited: MtLockRef<'_, _> = &mut visited;
272+
let usage_map: MtLockRef<'_, _> = &mut usage_map;
273273

274274
tcx.sess.time("monomorphization_collector_graph_walk", || {
275275
par_for_each_in(roots, |root| {
@@ -333,10 +333,10 @@ fn collect_roots(tcx: TyCtxt<'_>, mode: MonoItemCollectionMode) -> Vec<MonoItem<
333333
fn collect_items_rec<'tcx>(
334334
tcx: TyCtxt<'tcx>,
335335
starting_item: Spanned<MonoItem<'tcx>>,
336-
visited: MTLockRef<'_, FxHashSet<MonoItem<'tcx>>>,
336+
visited: MtLockRef<'_, FxHashSet<MonoItem<'tcx>>>,
337337
recursion_depths: &mut DefIdMap<usize>,
338338
recursion_limit: Limit,
339-
usage_map: MTLockRef<'_, UsageMap<'tcx>>,
339+
usage_map: MtLockRef<'_, UsageMap<'tcx>>,
340340
) {
341341
if !visited.lock_mut().insert(starting_item.node) {
342342
// We've been here already, no need to search again.

compiler/rustc_smir/src/rustc_internal/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ where
156156
(Ok(Ok(())), Some(ControlFlow::Break(value))) => Err(CompilerError::Interrupted(value)),
157157
(Ok(Ok(_)), None) => Err(CompilerError::Skipped),
158158
(Ok(Err(_)), _) => Err(CompilerError::CompilationFailed),
159-
(Err(_), _) => Err(CompilerError::ICE),
159+
(Err(_), _) => Err(CompilerError::Ice),
160160
}
161161
}
162162
}

compiler/stable_mir/src/lib.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ pub type ImplTraitDecls = Vec<ImplDef>;
8989
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
9090
pub enum CompilerError<T> {
9191
/// Internal compiler error (I.e.: Compiler crashed).
92-
#[allow(non_camel_case_types)]
93-
ICE,
92+
Ice,
9493
/// Compilation failed.
9594
CompilationFailed,
9695
/// Compilation was interrupted.

library/alloc/src/collections/btree/map.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use super::dedup_sorted_iter::DedupSortedIter;
1616
use super::navigate::{LazyLeafRange, LeafRange};
1717
use super::node::{self, marker, ForceResult::*, Handle, NodeRef, Root};
1818
use super::search::{SearchBound, SearchResult::*};
19-
use super::set_val::SetValZST;
19+
use super::set_val::SetValZst;
2020

2121
mod entry;
2222

@@ -288,7 +288,7 @@ impl<K: Clone, V: Clone, A: Allocator + Clone> Clone for BTreeMap<K, V, A> {
288288
}
289289
}
290290

291-
impl<K, Q: ?Sized, A: Allocator + Clone> super::Recover<Q> for BTreeMap<K, SetValZST, A>
291+
impl<K, Q: ?Sized, A: Allocator + Clone> super::Recover<Q> for BTreeMap<K, SetValZst, A>
292292
where
293293
K: Borrow<Q> + Ord,
294294
Q: Ord,
@@ -335,7 +335,7 @@ where
335335
alloc: (*map.alloc).clone(),
336336
_marker: PhantomData,
337337
}
338-
.insert(SetValZST::default());
338+
.insert(SetValZst::default());
339339
None
340340
}
341341
}

library/alloc/src/collections/btree/set.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use core::ops::{BitAnd, BitOr, BitXor, RangeBounds, Sub};
1010

1111
use super::map::{BTreeMap, Keys};
1212
use super::merge_iter::MergeIterInner;
13-
use super::set_val::SetValZST;
13+
use super::set_val::SetValZst;
1414
use super::Recover;
1515

1616
use crate::alloc::{Allocator, Global};
@@ -76,7 +76,7 @@ pub struct BTreeSet<
7676
T,
7777
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global,
7878
> {
79-
map: BTreeMap<T, SetValZST, A>,
79+
map: BTreeMap<T, SetValZst, A>,
8080
}
8181

8282
#[stable(feature = "rust1", since = "1.0.0")]
@@ -130,7 +130,7 @@ impl<T: Clone, A: Allocator + Clone> Clone for BTreeSet<T, A> {
130130
#[must_use = "iterators are lazy and do nothing unless consumed"]
131131
#[stable(feature = "rust1", since = "1.0.0")]
132132
pub struct Iter<'a, T: 'a> {
133-
iter: Keys<'a, T, SetValZST>,
133+
iter: Keys<'a, T, SetValZst>,
134134
}
135135

136136
#[stable(feature = "collection_debug", since = "1.17.0")]
@@ -152,7 +152,7 @@ pub struct IntoIter<
152152
T,
153153
#[unstable(feature = "allocator_api", issue = "32838")] A: Allocator + Clone = Global,
154154
> {
155-
iter: super::map::IntoIter<T, SetValZST, A>,
155+
iter: super::map::IntoIter<T, SetValZst, A>,
156156
}
157157

158158
/// An iterator over a sub-range of items in a `BTreeSet`.
@@ -165,7 +165,7 @@ pub struct IntoIter<
165165
#[derive(Debug)]
166166
#[stable(feature = "btree_range", since = "1.17.0")]
167167
pub struct Range<'a, T: 'a> {
168-
iter: super::map::Range<'a, T, SetValZST>,
168+
iter: super::map::Range<'a, T, SetValZst>,
169169
}
170170

171171
/// A lazy iterator producing elements in the difference of `BTreeSet`s.
@@ -900,7 +900,7 @@ impl<T, A: Allocator + Clone> BTreeSet<T, A> {
900900
where
901901
T: Ord,
902902
{
903-
self.map.insert(value, SetValZST::default()).is_none()
903+
self.map.insert(value, SetValZst::default()).is_none()
904904
}
905905

906906
/// Adds a value to the set, replacing the existing element, if any, that is
@@ -1197,7 +1197,7 @@ impl<T: Ord> FromIterator<T> for BTreeSet<T> {
11971197

11981198
impl<T: Ord, A: Allocator + Clone> BTreeSet<T, A> {
11991199
fn from_sorted_iter<I: Iterator<Item = T>>(iter: I, alloc: A) -> BTreeSet<T, A> {
1200-
let iter = iter.map(|k| (k, SetValZST::default()));
1200+
let iter = iter.map(|k| (k, SetValZst::default()));
12011201
let map = BTreeMap::bulk_build_from_sorted_iter(iter, alloc);
12021202
BTreeSet { map }
12031203
}
@@ -1221,7 +1221,7 @@ impl<T: Ord, const N: usize> From<[T; N]> for BTreeSet<T> {
12211221

12221222
// use stable sort to preserve the insertion order.
12231223
arr.sort();
1224-
let iter = IntoIterator::into_iter(arr).map(|k| (k, SetValZST::default()));
1224+
let iter = IntoIterator::into_iter(arr).map(|k| (k, SetValZst::default()));
12251225
let map = BTreeMap::bulk_build_from_sorted_iter(iter, Global);
12261226
BTreeSet { map }
12271227
}
@@ -1272,7 +1272,7 @@ pub struct ExtractIf<
12721272
F: 'a + FnMut(&T) -> bool,
12731273
{
12741274
pred: F,
1275-
inner: super::map::ExtractIfInner<'a, T, SetValZST>,
1275+
inner: super::map::ExtractIfInner<'a, T, SetValZst>,
12761276
/// The BTreeMap will outlive this IntoIter so we don't care about drop order for `alloc`.
12771277
alloc: A,
12781278
}
@@ -1297,7 +1297,7 @@ where
12971297

12981298
fn next(&mut self) -> Option<T> {
12991299
let pred = &mut self.pred;
1300-
let mut mapped_pred = |k: &T, _v: &mut SetValZST| pred(k);
1300+
let mut mapped_pred = |k: &T, _v: &mut SetValZst| pred(k);
13011301
self.inner.next(&mut mapped_pred, self.alloc.clone()).map(|(k, _)| k)
13021302
}
13031303

library/alloc/src/collections/btree/set_val.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22
/// Used instead of `()` to differentiate between:
33
/// * `BTreeMap<T, ()>` (possible user-defined map)
44
/// * `BTreeMap<T, SetValZST>` (internal set representation)
5-
#[allow(non_camel_case_types)]
65
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Default)]
7-
pub struct SetValZST;
6+
pub struct SetValZst;
87

98
/// A trait to differentiate between `BTreeMap` and `BTreeSet` values.
109
/// Returns `true` only for type `SetValZST`, `false` for all other types (blanket implementation).
@@ -23,7 +22,7 @@ impl<V> IsSetVal for V {
2322
}
2423

2524
// Specialization
26-
impl IsSetVal for SetValZST {
25+
impl IsSetVal for SetValZst {
2726
fn is_set_val() -> bool {
2827
true
2928
}

library/core/src/intrinsics.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -2478,16 +2478,15 @@ extern "rust-intrinsic" {
24782478
/// `unreachable_unchecked` is actually being reached. The bug is in *crate A*,
24792479
/// which violates the principle that a `const fn` must behave the same at
24802480
/// compile-time and at run-time. The unsafe code in crate B is fine.
2481-
#[allow(non_camel_case_types)]
24822481
#[rustc_const_unstable(feature = "const_eval_select", issue = "none")]
2483-
pub fn const_eval_select<ARG: Tuple, F, G, RET>(
2484-
arg: ARG,
2482+
pub fn const_eval_select<Arg: Tuple, F, G, Ret>(
2483+
arg: Arg,
24852484
called_in_const: F,
24862485
called_at_rt: G,
2487-
) -> RET
2486+
) -> Ret
24882487
where
2489-
G: FnOnce<ARG, Output = RET>,
2490-
F: FnOnce<ARG, Output = RET>;
2488+
G: FnOnce<Arg, Output = Ret>,
2489+
F: FnOnce<Arg, Output = Ret>;
24912490

24922491
/// This method creates a pointer to any `Some` value. If the argument is
24932492
/// `None`, an invalid within-bounds pointer (that is still acceptable for

library/core/src/iter/mod.rs

+2
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,8 @@ macro_rules! impl_fold_via_try_fold {
368368
impl_fold_via_try_fold! { @internal spec_rfold -> spec_try_rfold }
369369
};
370370
(@internal $fold:ident -> $try_fold:ident) => {
371+
// `A` and `F` are already used as generic parameters in impls where this macro appears,
372+
// hence the strange names
371373
#[allow(non_camel_case_types)]
372374
#[inline]
373375
fn $fold<AAA, FFF>(mut self, init: AAA, fold: FFF) -> AAA

library/std/src/sys/personality/dwarf/eh.rs

+14-14
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,15 @@ pub const DW_EH_PE_indirect: u8 = 0x80;
3737

3838
#[allow(non_camel_case_types)]
3939
#[derive(Copy, Clone)]
40-
pub struct EHContext<'a> {
40+
pub struct EhContext<'a> {
4141
pub ip: usize, // Current instruction pointer
4242
pub func_start: usize, // Address of the current function
4343
pub get_text_start: &'a dyn Fn() -> usize, // Get address of the code section
4444
pub get_data_start: &'a dyn Fn() -> usize, // Get address of the data section
4545
}
4646

4747
#[allow(non_camel_case_types)]
48-
pub enum EHAction {
48+
pub enum EhAction {
4949
None,
5050
Cleanup(usize),
5151
Catch(usize),
@@ -55,9 +55,9 @@ pub enum EHAction {
5555

5656
pub const USING_SJLJ_EXCEPTIONS: bool = cfg!(all(target_os = "ios", target_arch = "arm"));
5757

58-
pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result<EHAction, ()> {
58+
pub unsafe fn find_eh_action(lsda: *const u8, context: &EhContext<'_>) -> Result<EhAction, ()> {
5959
if lsda.is_null() {
60-
return Ok(EHAction::None);
60+
return Ok(EhAction::None);
6161
}
6262

6363
let func_start = context.func_start;
@@ -95,22 +95,22 @@ pub unsafe fn find_eh_action(lsda: *const u8, context: &EHContext<'_>) -> Result
9595
}
9696
if ip < func_start + cs_start + cs_len {
9797
if cs_lpad == 0 {
98-
return Ok(EHAction::None);
98+
return Ok(EhAction::None);
9999
} else {
100100
let lpad = lpad_base + cs_lpad;
101101
return Ok(interpret_cs_action(action_table as *mut u8, cs_action_entry, lpad));
102102
}
103103
}
104104
}
105105
// Ip is not present in the table. This indicates a nounwind call.
106-
Ok(EHAction::Terminate)
106+
Ok(EhAction::Terminate)
107107
} else {
108108
// SjLj version:
109109
// The "IP" is an index into the call-site table, with two exceptions:
110110
// -1 means 'no-action', and 0 means 'terminate'.
111111
match ip as isize {
112-
-1 => return Ok(EHAction::None),
113-
0 => return Ok(EHAction::Terminate),
112+
-1 => return Ok(EhAction::None),
113+
0 => return Ok(EhAction::Terminate),
114114
_ => (),
115115
}
116116
let mut idx = ip;
@@ -132,24 +132,24 @@ unsafe fn interpret_cs_action(
132132
action_table: *mut u8,
133133
cs_action_entry: u64,
134134
lpad: usize,
135-
) -> EHAction {
135+
) -> EhAction {
136136
if cs_action_entry == 0 {
137137
// If cs_action_entry is 0 then this is a cleanup (Drop::drop). We run these
138138
// for both Rust panics and foreign exceptions.
139-
EHAction::Cleanup(lpad)
139+
EhAction::Cleanup(lpad)
140140
} else {
141141
// If lpad != 0 and cs_action_entry != 0, we have to check ttype_index.
142142
// If ttype_index == 0 under the condition, we take cleanup action.
143143
let action_record = (action_table as *mut u8).offset(cs_action_entry as isize - 1);
144144
let mut action_reader = DwarfReader::new(action_record);
145145
let ttype_index = action_reader.read_sleb128();
146146
if ttype_index == 0 {
147-
EHAction::Cleanup(lpad)
147+
EhAction::Cleanup(lpad)
148148
} else if ttype_index > 0 {
149149
// Stop unwinding Rust panics at catch_unwind.
150-
EHAction::Catch(lpad)
150+
EhAction::Catch(lpad)
151151
} else {
152-
EHAction::Filter(lpad)
152+
EhAction::Filter(lpad)
153153
}
154154
}
155155
}
@@ -161,7 +161,7 @@ fn round_up(unrounded: usize, align: usize) -> Result<usize, ()> {
161161

162162
unsafe fn read_encoded_pointer(
163163
reader: &mut DwarfReader,
164-
context: &EHContext<'_>,
164+
context: &EhContext<'_>,
165165
encoding: u8,
166166
) -> Result<usize, ()> {
167167
if encoding == DW_EH_PE_omit {

0 commit comments

Comments
 (0)