Skip to content
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
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,6 @@ wasm-bindgen = "0.2.106"
unsafe_code = "allow"
unsafe_op_in_unsafe_fn = "deny"
elided_lifetimes_in_paths = "warn"
missing_copy_implementations = "warn"

[workspace.lints.clippy]
# alloc_instead_of_core = "warn"
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/anystr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ pub struct SplitArgs<T: TryFromObject> {
maxsplit: isize,
}

#[derive(Clone, Copy, FromArgs)]
#[derive(FromArgs)]
pub struct SplitLinesArgs {
#[pyarg(any, default = false)]
pub keepends: bool,
}

#[derive(Clone, Copy, FromArgs)]
#[derive(FromArgs)]
pub struct ExpandTabsArgs {
#[pyarg(any, default = 8)]
tabsize: isize,
Expand Down
4 changes: 1 addition & 3 deletions crates/vm/src/builtins/descriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,21 +168,19 @@ impl Representable for PyMethodDescriptor {
}
}

#[derive(Clone, Copy, Debug)]
#[derive(Debug)]
pub enum MemberKind {
Bool = 14,
ObjectEx = 16,
}

pub type MemberSetterFunc = Option<fn(&VirtualMachine, PyObjectRef, PySetterValue) -> PyResult<()>>;

#[derive(Clone, Copy)]
pub enum MemberGetter {
Getter(fn(&VirtualMachine, PyObjectRef) -> PyResult),
Offset(usize),
}

#[derive(Clone, Copy)]
pub enum MemberSetter {
Setter(MemberSetterFunc),
Offset(usize),
Expand Down
6 changes: 3 additions & 3 deletions crates/vm/src/builtins/module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
};

#[pyclass(module = false, name = "module")]
#[derive(Clone, Copy, Debug)]
#[derive(Debug)]
pub struct PyModuleDef {
// pub index: usize,
pub name: &'static PyStrInterned,
Expand All @@ -26,7 +26,7 @@ pub type ModuleCreate =
fn(&VirtualMachine, &PyObject, &'static PyModuleDef) -> PyResult<PyRef<PyModule>>;
pub type ModuleExec = fn(&VirtualMachine, &Py<PyModule>) -> PyResult<()>;

#[derive(Clone, Copy, Default)]
#[derive(Default)]
pub struct PyModuleSlots {
pub create: Option<ModuleCreate>,
pub exec: Option<ModuleExec>,
Expand Down Expand Up @@ -83,7 +83,7 @@ impl PyModuleDef {

#[allow(clippy::new_without_default)] // avoid Default implementation
#[pyclass(module = false, name = "module")]
#[derive(Clone, Copy, Debug)]
#[derive(Debug)]
pub struct PyModule {
// PyObject *md_dict;
pub def: Option<&'static PyModuleDef>,
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/builtins/namespace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use crate::{
///
/// SimpleNamespace(**kwargs)
#[pyclass(module = "types", name = "SimpleNamespace")]
#[derive(Copy, Clone, Debug, Default)]
pub struct PyNamespace;
#[derive(Debug, Default)]
pub struct PyNamespace {}

impl PyPayload for PyNamespace {
#[inline]
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use itertools::Itertools;
/// When called, it accepts no arguments and returns a new featureless
/// instance that has no instance attributes and cannot be given any.
#[pyclass(module = false, name = "object")]
#[derive(Clone, Copy, Debug)]
#[derive(Debug)]
pub struct PyBaseObject;

impl PyPayload for PyBaseObject {
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/builtins/singletons.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
};

#[pyclass(module = false, name = "NoneType")]
#[derive(Clone, Copy, Debug)]
#[derive(Debug)]
pub struct PyNone;

impl PyPayload for PyNone {
Expand Down Expand Up @@ -75,7 +75,7 @@ impl AsNumber for PyNone {
}

#[pyclass(module = false, name = "NotImplementedType")]
#[derive(Clone, Copy, Debug)]
#[derive(Debug)]
pub struct PyNotImplemented;

impl PyPayload for PyNotImplemented {
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/slice.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ impl Representable for PySlice {
}

#[pyclass(module = false, name = "EllipsisType")]
#[derive(Copy, Clone, Debug)]
#[derive(Debug)]
pub struct PyEllipsis;

impl PyPayload for PyEllipsis {
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ impl PyPayload for PyZip {
}
}

#[derive(Clone, Copy, FromArgs)]
#[derive(FromArgs)]
pub struct PyZipNewArgs {
#[pyarg(named, optional)]
strict: OptionalArg<bool>,
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/dict_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ struct DictEntry<T> {
}
static_assertions::assert_eq_size!(DictEntry<PyObjectRef>, Option<DictEntry<PyObjectRef>>);

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Debug, PartialEq, Eq)]
pub struct DictSize {
indices_size: usize,
pub entries_size: usize,
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/function/method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ macro_rules! define_methods {
};
}

#[derive(Clone, Copy)]
#[derive(Clone)]
pub struct PyMethodDef {
pub name: &'static str, // TODO: interned
pub func: &'static dyn PyNativeFn,
Expand Down Expand Up @@ -270,7 +270,7 @@ impl core::fmt::Debug for PyMethodDef {
// This is not a part of CPython API.
// But useful to support dynamically generated methods
#[pyclass(name, module = false, ctx = "method_def")]
#[derive(Clone, Copy, Debug)]
#[derive(Debug)]
pub struct HeapMethodDef {
method: PyMethodDef,
}
Expand Down
6 changes: 3 additions & 3 deletions crates/vm/src/function/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use num_traits::PrimInt;
/// method, this method will first be called to convert the object into a float.
/// If `__complex__()` is not defined then it falls back to `__float__()`. If
/// `__float__()` is not defined it falls back to `__index__()`.
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Debug, PartialEq)]
#[repr(transparent)]
pub struct ArgIntoComplex {
value: Complex64,
Expand Down Expand Up @@ -52,7 +52,7 @@ impl TryFromObject for ArgIntoComplex {
/// If the object is not a Python floating point object but has a `__float__()`
/// method, this method will first be called to convert the object into a float.
/// If `__float__()` is not defined then it falls back to `__index__()`.
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Debug, PartialEq)]
#[repr(transparent)]
pub struct ArgIntoFloat {
value: f64,
Expand Down Expand Up @@ -95,7 +95,7 @@ impl TryFromObject for ArgIntoFloat {
/// By default an object is considered true unless its class defines either a
/// `__bool__()` method that returns False or a `__len__()` method that returns
/// zero, when called with the object.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[derive(Debug, Default, PartialEq, Eq)]
pub struct ArgIntoBool {
value: bool,
}
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/protocol/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ use alloc::borrow::Cow;
use core::{fmt::Debug, ops::Range};
use itertools::Itertools;

#[derive(Clone, Copy)]
pub struct BufferMethods {
pub obj_bytes: fn(&PyBuffer) -> BorrowedValue<'_, [u8]>,
pub obj_bytes_mut: fn(&PyBuffer) -> BorrowedValueMut<'_, [u8]>,
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/protocol/mapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl PyMappingSlots {
}

#[allow(clippy::type_complexity)]
#[derive(Clone, Copy, Default)]
#[derive(Default)]
pub struct PyMappingMethods {
pub length: Option<fn(PyMapping<'_>, &VirtualMachine) -> PyResult<usize>>,
pub subscript: Option<fn(PyMapping<'_>, &PyObject, &VirtualMachine) -> PyResult>,
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/protocol/sequence.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ impl PySequenceSlots {
}

#[allow(clippy::type_complexity)]
#[derive(Clone, Copy, Default)]
#[derive(Default)]
pub struct PySequenceMethods {
pub length: Option<fn(PySequence<'_>, &VirtualMachine) -> PyResult<usize>>,
pub concat: Option<fn(PySequence<'_>, &PyObject, &VirtualMachine) -> PyResult>,
Expand Down
2 changes: 0 additions & 2 deletions crates/vm/src/sliceable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ impl<T: Clone> SliceableSequenceOp for [T] {
}
}

#[derive(Clone, Copy)]
pub enum SequenceIndex {
Int(isize),
Slice(SaturatedSlice),
Expand Down Expand Up @@ -404,7 +403,6 @@ impl SaturatedSlice {
}
}

#[derive(Clone, Copy)]
pub struct SaturatedSliceIter {
index: isize,
step: isize,
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/stdlib/marshal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ mod decl {
#[pyattr(name = "version")]
use marshal::FORMAT_VERSION;

#[derive(Clone, Copy)]
pub struct DumpError;

impl marshal::Dumpable for PyObjectRef {
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl crate::convert::IntoPyException for rustix::io::Errno {
}

#[allow(dead_code)]
#[derive(FromArgs, Default, Copy, Clone)]
#[derive(FromArgs, Default)]
pub struct TargetIsDirectory {
#[pyarg(any, default = false)]
pub(crate) target_is_directory: bool,
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/typevar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -988,7 +988,7 @@ pub(crate) mod typevar {

#[pyattr]
#[pyclass(name = "Generic", module = "typing")]
#[derive(Copy, Clone, Debug, PyPayload)]
#[derive(Debug, PyPayload)]
#[allow(dead_code)]
pub struct Generic;

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/typing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub(crate) mod decl {
}

#[pyclass(no_attr, name = "NoDefaultType", module = "typing")]
#[derive(Clone, Copy, Debug, PyPayload)]
#[derive(Debug, PyPayload)]
pub struct NoDefault;

#[pyclass(with(Constructor, Representable), flags(BASETYPE))]
Expand Down
Loading