Skip to content

Commit 4ae2936

Browse files
authored
fix more cspell warnings (RustPython#5689)
1 parent fd2764c commit 4ae2936

File tree

16 files changed

+171
-156
lines changed

16 files changed

+171
-156
lines changed

.cspell.dict/cpython.txt

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ elts
1717
excepthandler
1818
fileutils
1919
finalbody
20+
formatfloat
2021
freevar
2122
freevars
2223
fromlist
@@ -25,20 +26,25 @@ HIGHRES
2526
IMMUTABLETYPE
2627
kwonlyarg
2728
kwonlyargs
29+
lasti
2830
linearise
2931
maxdepth
3032
mult
3133
nkwargs
34+
noraise
3235
numer
3336
orelse
3437
pathconfig
3538
patma
3639
posonlyarg
3740
posonlyargs
3841
prec
42+
preinitialized
3943
PYTHREAD_NAME
4044
SA_ONSTACK
4145
stackdepth
46+
stringlib
47+
structseq
4248
tok_oldval
4349
unaryop
4450
unparse

.cspell.dict/python-more.txt

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ baserepl
1616
basicsize
1717
bdfl
1818
bigcharset
19+
bignum
1920
breakpointhook
2021
cformat
2122
chunksize
@@ -153,6 +154,7 @@ ospath
153154
pendingcr
154155
phello
155156
platlibdir
157+
popleft
156158
posixsubprocess
157159
posonly
158160
posonlyargcount

.cspell.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@
105105
"reducelib",
106106
"richcompare",
107107
"RustPython",
108+
"significand",
108109
"struc",
109-
// plural of summand
110-
"summands",
110+
"summands", // plural of summand
111111
"sysmodule",
112112
"tracebacks",
113113
"typealiases",

common/src/boxvec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// cspell:ignore
1+
// cspell:disable
22
//! An unresizable vector backed by a `Box<[T]>`
33
44
#![allow(clippy::needless_lifetimes)]

common/src/linked_list.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// cspell:disable
2+
13
//! This module is modified from tokio::util::linked_list: <https://github.com/tokio-rs/tokio/blob/master/tokio/src/util/linked_list.rs>
24
//! Tokio is licensed under the MIT license:
35
//!

common/src/lock.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,4 @@ pub type PyMappedRwLockReadGuard<'a, T> = MappedRwLockReadGuard<'a, RawRwLock, T
3939
pub type PyRwLockWriteGuard<'a, T> = RwLockWriteGuard<'a, RawRwLock, T>;
4040
pub type PyMappedRwLockWriteGuard<'a, T> = MappedRwLockWriteGuard<'a, RawRwLock, T>;
4141

42-
// can add fn const_{mutex,rwlock}() if necessary, but we probably won't need to
42+
// can add fn const_{mutex,rw_lock}() if necessary, but we probably won't need to

compiler/codegen/src/compile.rs

+15-15
Original file line numberDiff line numberDiff line change
@@ -2143,16 +2143,16 @@ impl Compiler<'_> {
21432143
attrs: &[Identifier],
21442144
_patterns: &[Pattern],
21452145
) -> CompileResult<()> {
2146-
let nattrs = attrs.len();
2147-
for i in 0..nattrs {
2146+
let n_attrs = attrs.len();
2147+
for i in 0..n_attrs {
21482148
let attr = attrs[i].as_str();
21492149
// Check if the attribute name is forbidden in a Store context.
21502150
if self.forbidden_name(attr, NameUsage::Store)? {
21512151
// Return an error if the name is forbidden.
21522152
return Err(self.compile_error_forbidden_name(attr));
21532153
}
21542154
// Check for duplicates: compare with every subsequent attribute.
2155-
for ident in attrs.iter().take(nattrs).skip(i + 1) {
2155+
for ident in attrs.iter().take(n_attrs).skip(i + 1) {
21562156
let other = ident.as_str();
21572157
if attr == other {
21582158
todo!();
@@ -2184,20 +2184,20 @@ impl Compiler<'_> {
21842184
}
21852185

21862186
let nargs = patterns.len();
2187-
let nattrs = kwd_attrs.len();
2187+
let n_attrs = kwd_attrs.len();
21882188
let nkwd_patterns = kwd_patterns.len();
21892189

21902190
// Validate that keyword attribute names and patterns match in length.
2191-
if nattrs != nkwd_patterns {
2191+
if n_attrs != nkwd_patterns {
21922192
let msg = format!(
21932193
"kwd_attrs ({}) / kwd_patterns ({}) length mismatch in class pattern",
2194-
nattrs, nkwd_patterns
2194+
n_attrs, nkwd_patterns
21952195
);
21962196
unreachable!("{}", msg);
21972197
}
21982198

21992199
// Check for too many sub-patterns.
2200-
if nargs > u32::MAX as usize || (nargs + nattrs).saturating_sub(1) > i32::MAX as usize {
2200+
if nargs > u32::MAX as usize || (nargs + n_attrs).saturating_sub(1) > i32::MAX as usize {
22012201
let msg = format!(
22022202
"too many sub-patterns in class pattern {:?}",
22032203
match_class.cls
@@ -2207,7 +2207,7 @@ impl Compiler<'_> {
22072207
}
22082208

22092209
// Validate keyword attributes if any.
2210-
if nattrs != 0 {
2210+
if n_attrs != 0 {
22112211
self.validate_kwd_attrs(&kwd_attrs, &kwd_patterns)?;
22122212
}
22132213

@@ -2237,12 +2237,12 @@ impl Compiler<'_> {
22372237
// 5. Compare with IS_OP 1.
22382238
emit!(self, Instruction::IsOperation(true));
22392239

2240-
// At this point the TOS is a tuple of (nargs + nattrs) attributes (or None).
2240+
// At this point the TOS is a tuple of (nargs + n_attrs) attributes (or None).
22412241
pc.on_top += 1;
22422242
self.jump_to_fail_pop(pc, JumpOp::PopJumpIfFalse)?;
22432243

2244-
// Unpack the tuple into (nargs + nattrs) items.
2245-
let total = nargs + nattrs;
2244+
// Unpack the tuple into (nargs + n_attrs) items.
2245+
let total = nargs + n_attrs;
22462246
emit!(
22472247
self,
22482248
Instruction::UnpackSequence {
@@ -2280,12 +2280,12 @@ impl Compiler<'_> {
22802280
// let keys = &mapping.keys;
22812281
// let patterns = &mapping.patterns;
22822282
// let size = keys.len();
2283-
// let npatterns = patterns.len();
2283+
// let n_patterns = patterns.len();
22842284

2285-
// if size != npatterns {
2286-
// panic!("keys ({}) / patterns ({}) length mismatch in mapping pattern", size, npatterns);
2285+
// if size != n_patterns {
2286+
// panic!("keys ({}) / patterns ({}) length mismatch in mapping pattern", size, n_patterns);
22872287
// // return self.compiler_error(
2288-
// // &format!("keys ({}) / patterns ({}) length mismatch in mapping pattern", size, npatterns)
2288+
// // &format!("keys ({}) / patterns ({}) length mismatch in mapping pattern", size, n_patterns)
22892289
// // );
22902290
// }
22912291

src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,14 @@ fn write_profile(settings: &Settings) -> Result<(), Box<dyn std::error::Error>>
233233
enum ProfileFormat {
234234
Html,
235235
Text,
236-
SpeedScore,
236+
SpeedScope,
237237
}
238238
let profile_output = settings.profile_output.as_deref();
239239
let profile_format = match settings.profile_format.as_deref() {
240240
Some("html") => ProfileFormat::Html,
241241
Some("text") => ProfileFormat::Text,
242242
None if profile_output == Some("-".as_ref()) => ProfileFormat::Text,
243-
Some("speedscope") | None => ProfileFormat::SpeedScore,
243+
Some("speedscope") | None => ProfileFormat::SpeedScope,
244244
Some(other) => {
245245
error!("Unknown profile format {}", other);
246246
// TODO: Need to change to ExitCode or Termination
@@ -251,7 +251,7 @@ fn write_profile(settings: &Settings) -> Result<(), Box<dyn std::error::Error>>
251251
let profile_output = profile_output.unwrap_or_else(|| match profile_format {
252252
ProfileFormat::Html => "flame-graph.html".as_ref(),
253253
ProfileFormat::Text => "flame.txt".as_ref(),
254-
ProfileFormat::SpeedScore => "flamescope.json".as_ref(),
254+
ProfileFormat::SpeedScope => "flamescope.json".as_ref(),
255255
});
256256

257257
let profile_output: Box<dyn io::Write> = if profile_output == "-" {
@@ -265,7 +265,7 @@ fn write_profile(settings: &Settings) -> Result<(), Box<dyn std::error::Error>>
265265
match profile_format {
266266
ProfileFormat::Html => flame::dump_html(profile_output)?,
267267
ProfileFormat::Text => flame::dump_text_to_writer(profile_output)?,
268-
ProfileFormat::SpeedScore => flamescope::dump(profile_output)?,
268+
ProfileFormat::SpeedScope => flamescope::dump(profile_output)?,
269269
}
270270

271271
Ok(())

0 commit comments

Comments
 (0)