Skip to content

Commit 1a4a712

Browse files
committed
temp
1 parent 278be3f commit 1a4a712

33 files changed

+329
-177
lines changed

crates/derive-impl/src/pyclass.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,10 @@ pub(crate) fn impl_pyexception_impl(attr: PunctuatedNestedMeta, item: Item) -> R
637637
if path.is_ident("with") {
638638
// Check if Constructor is in the list
639639
for meta in nested {
640-
if let NestedMeta::Meta(Meta::Path(p)) = meta {
641-
if p.is_ident("Constructor") {
642-
has_constructor_trait = true;
643-
}
640+
if let NestedMeta::Meta(Meta::Path(p)) = meta
641+
&& p.is_ident("Constructor")
642+
{
643+
has_constructor_trait = true;
644644
}
645645
}
646646
}

crates/stdlib/src/bz2.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mod _bz2 {
1212
builtins::{PyBytesRef, PyType},
1313
common::lock::PyMutex,
1414
function::{ArgBytesLike, OptionalArg},
15-
object::{PyPayload, PyResult},
15+
object::PyResult,
1616
types::Constructor,
1717
};
1818
use bzip2::{Decompress, Status, write::BzEncoder};

crates/stdlib/src/mmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ mod mmap {
388388
type Args = MmapNewArgs;
389389

390390
#[cfg(unix)]
391-
fn py_new(cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
391+
fn py_new(_cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
392392
use libc::{MAP_PRIVATE, MAP_SHARED, PROT_READ, PROT_WRITE};
393393

394394
let mut map_size = args.validate_new_args(vm)?;

crates/vm/src/builtins/classmethod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ impl GetDescriptor for PyClassMethod {
6969
impl Constructor for PyClassMethod {
7070
type Args = PyObjectRef;
7171

72-
fn py_new(cls: &Py<PyType>, callable: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
72+
fn py_new(_cls: &Py<PyType>, callable: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
7373
// TODO: The dict attribute copying logic needs to be moved elsewhere
7474
// For now, just return the payload. The dict logic should be handled
7575
// by slot_new or in a custom implementation

crates/vm/src/builtins/code.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ pub struct PyCodeNewArgs {
390390
impl Constructor for PyCode {
391391
type Args = PyCodeNewArgs;
392392

393-
fn py_new(cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
393+
fn py_new(_cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
394394
// Convert names tuple to vector of interned strings
395395
let names: Box<[&'static PyStrInterned]> = args
396396
.names

crates/vm/src/builtins/complex.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,13 @@ impl Constructor for PyComplex {
153153

154154
fn slot_new(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult {
155155
// Optimization: return exact complex as-is (only when imag is not provided)
156-
if cls.is(vm.ctx.types.complex_type) && args.args.len() == 1 && args.kwargs.is_empty() {
157-
if args.args[0].class().is(vm.ctx.types.complex_type) {
158-
let mut args = args;
159-
return Ok(args.args.pop().expect("length checked"));
160-
}
156+
if cls.is(vm.ctx.types.complex_type)
157+
&& args.args.len() == 1
158+
&& args.kwargs.is_empty()
159+
&& args.args[0].class().is(vm.ctx.types.complex_type)
160+
{
161+
let mut args = args;
162+
return Ok(args.args.pop().expect("length checked"));
161163
}
162164

163165
let cargs: Self::Args = args.bind(vm)?;

crates/vm/src/builtins/float.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,13 @@ impl Constructor for PyFloat {
133133

134134
fn slot_new(cls: PyTypeRef, args: FuncArgs, vm: &VirtualMachine) -> PyResult {
135135
// Optimization: return exact float as-is
136-
if cls.is(vm.ctx.types.float_type) && args.args.len() == 1 && args.kwargs.is_empty() {
137-
if args.args[0].class().is(vm.ctx.types.float_type) {
138-
let mut args = args;
139-
return Ok(args.args.pop().expect("length checked"));
140-
}
136+
if cls.is(vm.ctx.types.float_type)
137+
&& args.args.len() == 1
138+
&& args.kwargs.is_empty()
139+
&& args.args[0].class().is(vm.ctx.types.float_type)
140+
{
141+
let mut args = args;
142+
return Ok(args.args.pop().expect("length checked"));
141143
}
142144

143145
let arg: Self::Args = args.bind(vm)?;

crates/vm/src/builtins/function.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ pub struct PyFunctionNewArgs {
670670
impl Constructor for PyFunction {
671671
type Args = PyFunctionNewArgs;
672672

673-
fn py_new(cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
673+
fn py_new(_cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
674674
// Handle closure - must be a tuple of cells
675675
let closure = if let Some(closure_tuple) = args.closure.into_option() {
676676
// Check that closure length matches code's free variables
@@ -771,9 +771,9 @@ impl Constructor for PyBoundMethod {
771771
type Args = PyBoundMethodNewArgs;
772772

773773
fn py_new(
774-
cls: &Py<PyType>,
774+
_cls: &Py<PyType>,
775775
Self::Args { function, object }: Self::Args,
776-
vm: &VirtualMachine,
776+
_vm: &VirtualMachine,
777777
) -> PyResult<Self> {
778778
Ok(Self::new(object, function))
779779
}
@@ -895,7 +895,7 @@ impl PyPayload for PyCell {
895895
impl Constructor for PyCell {
896896
type Args = OptionalArg;
897897

898-
fn py_new(cls: &Py<PyType>, value: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
898+
fn py_new(_cls: &Py<PyType>, value: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
899899
Ok(Self::new(value.into_option()))
900900
}
901901
}

crates/vm/src/builtins/mappingproxy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl From<PyDictRef> for PyMappingProxy {
6161
impl Constructor for PyMappingProxy {
6262
type Args = PyObjectRef;
6363

64-
fn py_new(cls: &Py<PyType>, mapping: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
64+
fn py_new(_cls: &Py<PyType>, mapping: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
6565
if let Some(methods) = PyMapping::find_methods(&mapping)
6666
&& !mapping.downcastable::<PyList>()
6767
&& !mapping.downcastable::<PyTuple>()

crates/vm/src/builtins/memory.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ pub struct PyMemoryView {
6161
impl Constructor for PyMemoryView {
6262
type Args = PyMemoryViewNewArgs;
6363

64-
fn py_new(cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
64+
fn py_new(_cls: &Py<PyType>, args: Self::Args, vm: &VirtualMachine) -> PyResult<Self> {
6565
Self::from_object(&args.object, vm)
6666
}
6767
}

0 commit comments

Comments
 (0)