Skip to content

fix more cspell warnings #5689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .cspell.dict/cpython.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ elts
excepthandler
fileutils
finalbody
formatfloat
freevar
freevars
fromlist
Expand All @@ -25,20 +26,25 @@ HIGHRES
IMMUTABLETYPE
kwonlyarg
kwonlyargs
lasti
linearise
maxdepth
mult
nkwargs
noraise
numer
orelse
pathconfig
patma
posonlyarg
posonlyargs
prec
preinitialized
PYTHREAD_NAME
SA_ONSTACK
stackdepth
stringlib
structseq
tok_oldval
unaryop
unparse
Expand Down
2 changes: 2 additions & 0 deletions .cspell.dict/python-more.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ baserepl
basicsize
bdfl
bigcharset
bignum
breakpointhook
cformat
chunksize
Expand Down Expand Up @@ -153,6 +154,7 @@ ospath
pendingcr
phello
platlibdir
popleft
posixsubprocess
posonly
posonlyargcount
Expand Down
4 changes: 2 additions & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@
"reducelib",
"richcompare",
"RustPython",
"significand",
"struc",
// plural of summand
"summands",
"summands", // plural of summand
"sysmodule",
"tracebacks",
"typealiases",
Expand Down
2 changes: 1 addition & 1 deletion common/src/boxvec.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// cspell:ignore
// cspell:disable
//! An unresizable vector backed by a `Box<[T]>`

#![allow(clippy::needless_lifetimes)]
Expand Down
2 changes: 2 additions & 0 deletions common/src/linked_list.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// cspell:disable

//! This module is modified from tokio::util::linked_list: <https://github.com/tokio-rs/tokio/blob/master/tokio/src/util/linked_list.rs>
//! Tokio is licensed under the MIT license:
//!
Expand Down
2 changes: 1 addition & 1 deletion common/src/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@ pub type PyMappedRwLockReadGuard<'a, T> = MappedRwLockReadGuard<'a, RawRwLock, T
pub type PyRwLockWriteGuard<'a, T> = RwLockWriteGuard<'a, RawRwLock, T>;
pub type PyMappedRwLockWriteGuard<'a, T> = MappedRwLockWriteGuard<'a, RawRwLock, T>;

// can add fn const_{mutex,rwlock}() if necessary, but we probably won't need to
// can add fn const_{mutex,rw_lock}() if necessary, but we probably won't need to
30 changes: 15 additions & 15 deletions compiler/codegen/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2143,16 +2143,16 @@
attrs: &[Identifier],
_patterns: &[Pattern],
) -> CompileResult<()> {
let nattrs = attrs.len();
for i in 0..nattrs {
let n_attrs = attrs.len();
for i in 0..n_attrs {
let attr = attrs[i].as_str();
// Check if the attribute name is forbidden in a Store context.
if self.forbidden_name(attr, NameUsage::Store)? {
// Return an error if the name is forbidden.
return Err(self.compile_error_forbidden_name(attr));
}
// Check for duplicates: compare with every subsequent attribute.
for ident in attrs.iter().take(nattrs).skip(i + 1) {
for ident in attrs.iter().take(n_attrs).skip(i + 1) {
let other = ident.as_str();
if attr == other {
todo!();
Expand Down Expand Up @@ -2184,20 +2184,20 @@
}

let nargs = patterns.len();
let nattrs = kwd_attrs.len();
let n_attrs = kwd_attrs.len();
let nkwd_patterns = kwd_patterns.len();

Check warning on line 2188 in compiler/codegen/src/compile.rs

View workflow job for this annotation

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (nkwd)

// Validate that keyword attribute names and patterns match in length.
if nattrs != nkwd_patterns {
if n_attrs != nkwd_patterns {

Check warning on line 2191 in compiler/codegen/src/compile.rs

View workflow job for this annotation

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (nkwd)
let msg = format!(
"kwd_attrs ({}) / kwd_patterns ({}) length mismatch in class pattern",
nattrs, nkwd_patterns
n_attrs, nkwd_patterns

Check warning on line 2194 in compiler/codegen/src/compile.rs

View workflow job for this annotation

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (nkwd)
);
unreachable!("{}", msg);
}

// Check for too many sub-patterns.
if nargs > u32::MAX as usize || (nargs + nattrs).saturating_sub(1) > i32::MAX as usize {
if nargs > u32::MAX as usize || (nargs + n_attrs).saturating_sub(1) > i32::MAX as usize {
let msg = format!(
"too many sub-patterns in class pattern {:?}",
match_class.cls
Expand All @@ -2207,7 +2207,7 @@
}

// Validate keyword attributes if any.
if nattrs != 0 {
if n_attrs != 0 {
self.validate_kwd_attrs(&kwd_attrs, &kwd_patterns)?;
}

Expand Down Expand Up @@ -2237,12 +2237,12 @@
// 5. Compare with IS_OP 1.
emit!(self, Instruction::IsOperation(true));

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

// Unpack the tuple into (nargs + nattrs) items.
let total = nargs + nattrs;
// Unpack the tuple into (nargs + n_attrs) items.
let total = nargs + n_attrs;
emit!(
self,
Instruction::UnpackSequence {
Expand Down Expand Up @@ -2280,12 +2280,12 @@
// let keys = &mapping.keys;
// let patterns = &mapping.patterns;
// let size = keys.len();
// let npatterns = patterns.len();
// let n_patterns = patterns.len();

// if size != npatterns {
// panic!("keys ({}) / patterns ({}) length mismatch in mapping pattern", size, npatterns);
// if size != n_patterns {
// panic!("keys ({}) / patterns ({}) length mismatch in mapping pattern", size, n_patterns);
// // return self.compiler_error(
// // &format!("keys ({}) / patterns ({}) length mismatch in mapping pattern", size, npatterns)
// // &format!("keys ({}) / patterns ({}) length mismatch in mapping pattern", size, n_patterns)
// // );
// }

Expand Down Expand Up @@ -2481,10 +2481,10 @@

// Adjust the final captures.
let nstores = control.as_ref().unwrap().len();
let nrots = nstores + 1 + pc.on_top + pc.stores.len();

Check warning on line 2484 in compiler/codegen/src/compile.rs

View workflow job for this annotation

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (nrots)
for i in 0..nstores {
// Rotate the capture to its proper place.
self.pattern_helper_rotate(nrots)?;

Check warning on line 2487 in compiler/codegen/src/compile.rs

View workflow job for this annotation

GitHub Actions / Check Rust code with rustfmt and clippy

Unknown word (nrots)
let name = &control.as_ref().unwrap()[i];
// Check for duplicate binding.
if pc.stores.iter().any(|n| n == name) {
Expand Down
8 changes: 4 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,14 @@ fn write_profile(settings: &Settings) -> Result<(), Box<dyn std::error::Error>>
enum ProfileFormat {
Html,
Text,
SpeedScore,
SpeedScope,
}
let profile_output = settings.profile_output.as_deref();
let profile_format = match settings.profile_format.as_deref() {
Some("html") => ProfileFormat::Html,
Some("text") => ProfileFormat::Text,
None if profile_output == Some("-".as_ref()) => ProfileFormat::Text,
Some("speedscope") | None => ProfileFormat::SpeedScore,
Some("speedscope") | None => ProfileFormat::SpeedScope,
Some(other) => {
error!("Unknown profile format {}", other);
// TODO: Need to change to ExitCode or Termination
Expand All @@ -251,7 +251,7 @@ fn write_profile(settings: &Settings) -> Result<(), Box<dyn std::error::Error>>
let profile_output = profile_output.unwrap_or_else(|| match profile_format {
ProfileFormat::Html => "flame-graph.html".as_ref(),
ProfileFormat::Text => "flame.txt".as_ref(),
ProfileFormat::SpeedScore => "flamescope.json".as_ref(),
ProfileFormat::SpeedScope => "flamescope.json".as_ref(),
});

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

Ok(())
Expand Down
Loading
Loading