Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Auto-format: cargo fmt --all
  • Loading branch information
github-actions[bot] committed Dec 29, 2025
commit 86957cc9fc62f53578b51e0a7dcc70ab14fd0ca1
2 changes: 1 addition & 1 deletion crates/codegen/src/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ use crate::{
symboltable::{self, CompilerScope, SymbolFlags, SymbolScope, SymbolTable},
unparse::UnparseExpr,
};
use alloc::borrow::Cow;
use itertools::Itertools;
use malachite_bigint::BigInt;
use num_complex::Complex;
Expand All @@ -42,7 +43,6 @@ use rustpython_compiler_core::{
},
};
use rustpython_wtf8::Wtf8Buf;
use alloc::borrow::Cow;
use std::collections::HashSet;

const MAXBLOCKS: usize = 20;
Expand Down
2 changes: 1 addition & 1 deletion crates/codegen/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use rustpython_compiler_core::SourceLocation;
use alloc::fmt;
use core::fmt::Display;
use rustpython_compiler_core::SourceLocation;
use thiserror::Error;

#[derive(Debug)]
Expand Down
4 changes: 2 additions & 2 deletions crates/codegen/src/symboltable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::{
IndexMap,
error::{CodegenError, CodegenErrorType},
};
use alloc::{borrow::Cow, fmt};
use bitflags::bitflags;
use ruff_python_ast::{
self as ast, Comprehension, Decorator, Expr, Identifier, ModExpression, ModModule, Parameter,
Expand All @@ -20,7 +21,6 @@ use ruff_python_ast::{
};
use ruff_text_size::{Ranged, TextRange};
use rustpython_compiler_core::{PositionEncoding, SourceFile, SourceLocation};
use alloc::{borrow::Cow, fmt};

/// Captures all symbols in the current scope, and has a list of sub-scopes in this scope.
#[derive(Clone)]
Expand Down Expand Up @@ -261,8 +261,8 @@ fn drop_class_free(symbol_table: &mut SymbolTable) {
type SymbolMap = IndexMap<String, Symbol>;

mod stack {
use std::panic;
use core::ptr::NonNull;
use std::panic;
pub struct StackStack<T> {
v: Vec<NonNull<T>>,
}
Expand Down
4 changes: 2 additions & 2 deletions crates/codegen/src/unparse.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use alloc::fmt;
use core::fmt::Display as _;
use ruff_python_ast::{
self as ruff, Arguments, BoolOp, Comprehension, ConversionFlag, Expr, Identifier, Operator,
Parameter, ParameterWithDefault, Parameters,
};
use ruff_text_size::Ranged;
use rustpython_compiler_core::SourceFile;
use rustpython_literal::escape::{AsciiEscape, UnicodeEscape};
use alloc::fmt;
use core::fmt::Display as _;

mod precedence {
macro_rules! precedence {
Expand Down
4 changes: 2 additions & 2 deletions crates/common/src/boxvec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
use alloc::{fmt, slice};
use core::{
borrow::{Borrow, BorrowMut},
cmp,
cmp,
mem::{self, MaybeUninit},
ops::{Bound, Deref, DerefMut, RangeBounds},
ptr,
ptr,
};

pub struct BoxVec<T> {
Expand Down
10 changes: 5 additions & 5 deletions crates/common/src/cformat.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
//! Implementation of Printf-Style string formatting
//! as per the [Python Docs](https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting).
use bitflags::bitflags;
use itertools::Itertools;
use malachite_bigint::{BigInt, Sign};
use num_traits::Signed;
use rustpython_literal::{float, format::Case};
use alloc::fmt;
use bitflags::bitflags;
use core::{
cmp,
iter::{Enumerate, Peekable},
str::FromStr,
};
use itertools::Itertools;
use malachite_bigint::{BigInt, Sign};
use num_traits::Signed;
use rustpython_literal::{float, format::Case};

use crate::wtf8::{CodePoint, Wtf8, Wtf8Buf};

Expand Down
4 changes: 2 additions & 2 deletions crates/common/src/format.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
// spell-checker:ignore ddfe
use core::ops::Deref;
use core::{cmp, str::FromStr};
use itertools::{Itertools, PeekingNext};
use malachite_base::num::basic::floats::PrimitiveFloat;
use malachite_bigint::{BigInt, Sign};
Expand All @@ -7,8 +9,6 @@ use num_traits::FromPrimitive;
use num_traits::{Signed, cast::ToPrimitive};
use rustpython_literal::float;
use rustpython_literal::format::Case;
use core::ops::Deref;
use core::{cmp, str::FromStr};

use crate::wtf8::{CodePoint, Wtf8, Wtf8Buf};

Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/hash.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::hash::{BuildHasher, Hash, Hasher};
use malachite_bigint::BigInt;
use num_traits::ToPrimitive;
use siphasher::sip::SipHasher24;
use core::hash::{BuildHasher, Hash, Hasher};

pub type PyHash = i64;
pub type PyUHash = u64;
Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/lock/cell_lock.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// spell-checker:ignore upgradably sharedly
use core::{cell::Cell, num::NonZero};
use lock_api::{
GetThreadId, RawMutex, RawRwLock, RawRwLockDowngrade, RawRwLockRecursive, RawRwLockUpgrade,
RawRwLockUpgradeDowngrade,
};
use core::{cell::Cell, num::NonZero};

pub struct RawCellMutex {
locked: Cell<bool>,
Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/lock/immutable_mutex.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#![allow(clippy::needless_lifetimes)]

use lock_api::{MutexGuard, RawMutex};
use alloc::fmt;
use core::{marker::PhantomData, ops::Deref};
use lock_api::{MutexGuard, RawMutex};

/// A mutex guard that has an exclusive lock, but only an immutable reference; useful if you
/// need to map a mutex guard with a function that returns an `&T`. Construct using the
Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/lock/thread_mutex.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#![allow(clippy::needless_lifetimes)]

use lock_api::{GetThreadId, GuardNoSend, RawMutex};
use alloc::fmt;
use core::{
cell::UnsafeCell,
Expand All @@ -9,6 +8,7 @@ use core::{
ptr::NonNull,
sync::atomic::{AtomicUsize, Ordering},
};
use lock_api::{GetThreadId, GuardNoSend, RawMutex};

// based off ReentrantMutex from lock_api

Expand Down
2 changes: 1 addition & 1 deletion crates/common/src/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use crate::format::CharLen;
use crate::wtf8::{CodePoint, Wtf8, Wtf8Buf};
use ascii::{AsciiChar, AsciiStr, AsciiString};
use core::fmt;
use core::sync::atomic::Ordering::Relaxed;
use core::ops::{Bound, RangeBounds};
use core::sync::atomic::Ordering::Relaxed;

#[cfg(not(target_arch = "wasm32"))]
#[allow(non_camel_case_types)]
Expand Down
4 changes: 2 additions & 2 deletions crates/compiler-core/src/bytecode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ use crate::{
marshal::MarshalError,
{OneIndexed, SourceLocation},
};
use alloc::{collections::BTreeSet, fmt};
use bitflags::bitflags;
use core::{hash, marker::PhantomData, mem, num::NonZeroU8, ops::Deref};
use itertools::Itertools;
use malachite_bigint::BigInt;
use num_complex::Complex64;
use rustpython_wtf8::{Wtf8, Wtf8Buf};
use alloc::{collections::BTreeSet, fmt};
use core::{hash, marker::PhantomData, mem, num::NonZeroU8, ops::Deref};

/// Oparg values for [`Instruction::ConvertValue`].
///
Expand Down
2 changes: 1 addition & 1 deletion crates/compiler-core/src/marshal.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use crate::{OneIndexed, SourceLocation, bytecode::*};
use core::convert::Infallible;
use malachite_bigint::{BigInt, Sign};
use num_complex::Complex64;
use rustpython_wtf8::Wtf8;
use core::convert::Infallible;

pub const FORMAT_VERSION: u32 = 4;

Expand Down
2 changes: 1 addition & 1 deletion crates/derive-impl/src/pyclass.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ use crate::util::{
ItemMeta, ItemMetaInner, ItemNursery, SimpleItemMeta, format_doc, pyclass_ident_and_attrs,
pyexception_ident_and_attrs, text_signature,
};
use core::str::FromStr;
use proc_macro2::{Delimiter, Group, Span, TokenStream, TokenTree};
use quote::{ToTokens, quote, quote_spanned};
use rustpython_doc::DB;
use std::collections::{HashMap, HashSet};
use core::str::FromStr;
use syn::{Attribute, Ident, Item, Result, parse_quote, spanned::Spanned};
use syn_ext::ext::*;
use syn_ext::types::*;
Expand Down
4 changes: 2 additions & 2 deletions crates/derive-impl/src/pymodule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ use crate::util::{
ErrorVec, ItemMeta, ItemNursery, ModuleItemMeta, SimpleItemMeta, format_doc, iter_use_idents,
pyclass_ident_and_attrs, text_signature,
};
use core::str::FromStr;
use proc_macro2::{Delimiter, Group, TokenStream, TokenTree};
use quote::{ToTokens, quote, quote_spanned};
use rustpython_doc::DB;
use std::{collections::HashSet};
use core::str::FromStr;
use std::collections::HashSet;
use syn::{Attribute, Ident, Item, Result, parse_quote, spanned::Spanned};
use syn_ext::ext::*;
use syn_ext::types::PunctuatedNestedMeta;
Expand Down
2 changes: 1 addition & 1 deletion crates/sre_engine/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::string::{
};

use super::{MAXREPEAT, SreAtCode, SreCatCode, SreInfo, SreOpcode, StrDrive, StringCursor};
use optional::Optioned;
use core::{convert::TryFrom, ptr::null};
use optional::Optioned;

#[derive(Debug, Clone, Copy)]
pub struct Request<'a, S> {
Expand Down
4 changes: 2 additions & 2 deletions crates/stdlib/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@ mod array {
},
},
};
use alloc::fmt;
use core::cmp::Ordering;
use itertools::Itertools;
use num_traits::ToPrimitive;
use rustpython_common::wtf8::{CodePoint, Wtf8, Wtf8Buf};
use alloc::fmt;
use core::cmp::Ordering;
use std::os::raw;
macro_rules! def_array_enum {
($(($n:ident, $t:ty, $c:literal, $scode:literal)),*$(,)?) => {
Expand Down
2 changes: 1 addition & 1 deletion crates/stdlib/src/bz2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ mod _bz2 {
object::PyResult,
types::Constructor,
};
use alloc::fmt;
use bzip2::{Decompress, Status, write::BzEncoder};
use rustpython_vm::convert::ToPyException;
use std::io::Write;
use alloc::fmt;

const BUFSIZ: usize = 8192;

Expand Down
6 changes: 3 additions & 3 deletions crates/stdlib/src/contextvars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ mod _contextvars {
protocol::{PyMappingMethods, PySequenceMethods},
types::{AsMapping, AsSequence, Constructor, Hashable, Representable},
};
use crossbeam_utils::atomic::AtomicCell;
use indexmap::IndexMap;
use std::sync::LazyLock;
use core::{
cell::{Cell, RefCell, UnsafeCell},
sync::atomic::Ordering,
};
use crossbeam_utils::atomic::AtomicCell;
use indexmap::IndexMap;
use std::sync::LazyLock;

// TODO: Real hamt implementation
type Hamt = IndexMap<PyRef<ContextVar>, PyObjectRef, ahash::RandomState>;
Expand Down
6 changes: 3 additions & 3 deletions crates/stdlib/src/csv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ mod _csv {
raise_if_stop,
types::{Constructor, IterNext, Iterable, SelfIter},
};
use alloc::fmt;
use csv_core::Terminator;
use itertools::{self, Itertools};
use parking_lot::Mutex;
use rustpython_vm::match_class;
use std::collections::HashMap;
use std::sync::LazyLock;
use std::{collections::HashMap};
use alloc::fmt;


#[pyattr]
const QUOTE_MINIMAL: i32 = QuoteStyle::Minimal as i32;
#[pyattr]
Expand Down
9 changes: 5 additions & 4 deletions crates/stdlib/src/faulthandler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ mod decl {
PyObjectRef, PyResult, VirtualMachine, builtins::PyFloat, frame::Frame,
function::OptionalArg, py_io::Write,
};
use alloc::sync::Arc;
use core::sync::atomic::{AtomicBool, AtomicI32, Ordering};
use core::time::Duration;
use parking_lot::{Condvar, Mutex};
#[cfg(any(unix, windows))]
use rustpython_common::os::{get_errno, set_errno};
use alloc::sync::Arc;
use core::sync::atomic::{AtomicBool, AtomicI32, Ordering};
use std::thread;
use core::time::Duration;

/// fault_handler_t
#[cfg(unix)]
Expand Down Expand Up @@ -144,7 +144,8 @@ mod decl {
static mut FRAME_SNAPSHOTS: [FrameSnapshot; MAX_SNAPSHOT_FRAMES] =
[FrameSnapshot::EMPTY; MAX_SNAPSHOT_FRAMES];
#[cfg(any(unix, windows))]
static SNAPSHOT_COUNT: core::sync::atomic::AtomicUsize = core::sync::atomic::AtomicUsize::new(0);
static SNAPSHOT_COUNT: core::sync::atomic::AtomicUsize =
core::sync::atomic::AtomicUsize::new(0);

// Signal-safe output functions

Expand Down
2 changes: 1 addition & 1 deletion crates/stdlib/src/grp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ mod grp {
exceptions,
types::PyStructSequence,
};
use nix::unistd;
use core::ptr::NonNull;
use nix::unistd;

#[pystruct_sequence_data]
struct GroupData {
Expand Down
2 changes: 1 addition & 1 deletion crates/stdlib/src/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ mod _json {
protocol::PyIterReturn,
types::{Callable, Constructor},
};
use core::str::FromStr;
use malachite_bigint::BigInt;
use rustpython_common::wtf8::Wtf8Buf;
use core::str::FromStr;

#[pyattr(name = "make_scanner")]
#[pyclass(name = "Scanner", traverse)]
Expand Down
1 change: 0 additions & 1 deletion crates/stdlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#![allow(clippy::module_inception)]
#![cfg_attr(all(target_os = "wasi", target_env = "p2"), feature(wasip2))]


#[macro_use]
extern crate rustpython_derive;
extern crate alloc;
Expand Down
7 changes: 2 additions & 5 deletions crates/stdlib/src/locale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,14 @@ use libc::localeconv;

#[pymodule]
mod _locale {
use alloc::ffi::CString;
use core::{ffi::CStr, ptr};
use rustpython_vm::{
PyObjectRef, PyResult, VirtualMachine,
builtins::{PyDictRef, PyIntRef, PyListRef, PyStrRef, PyTypeRef},
convert::ToPyException,
function::OptionalArg,
};
use alloc::ffi::CString;
use core::{
ffi::CStr,
ptr,
};

#[cfg(all(
unix,
Expand Down
2 changes: 1 addition & 1 deletion crates/stdlib/src/lzma.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod _lzma {
CompressFlushKind, CompressState, CompressStatusKind, Compressor, DecompressArgs,
DecompressError, DecompressState, DecompressStatus, Decompressor,
};
use alloc::fmt;
#[pyattr]
use lzma_sys::{
LZMA_CHECK_CRC32 as CHECK_CRC32, LZMA_CHECK_CRC64 as CHECK_CRC64,
Expand Down Expand Up @@ -38,7 +39,6 @@ mod _lzma {
use rustpython_vm::function::ArgBytesLike;
use rustpython_vm::types::Constructor;
use rustpython_vm::{Py, PyObjectRef, PyPayload, PyResult, VirtualMachine};
use alloc::fmt;
use xz2::stream::{Action, Check, Error, Filters, LzmaOptions, Status, Stream};

#[cfg(windows)]
Expand Down
2 changes: 1 addition & 1 deletion crates/stdlib/src/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ mod math {
function::{ArgIndex, ArgIntoFloat, ArgIterable, Either, OptionalArg, PosArgs},
identifier,
};
use core::cmp::Ordering;
use itertools::Itertools;
use malachite_bigint::BigInt;
use num_traits::{One, Signed, ToPrimitive, Zero};
use rustpython_common::{float_ops, int::true_div};
use core::cmp::Ordering;

// Constants
#[pyattr]
Expand Down
Loading
Loading