mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-28 18:59:04 +08:00
a few unreachable->unimplemented, clippy (#6405)
* unreachable -> unimplemented * Fix clippy on 1.92
This commit is contained in:
1 parent
f379ea8327
commit
bfd873a8b8
27 files changed
+31
-34
No files matched your search
@@ -380,7 +380,11 @@ impl<'a, 'b, 'c> Unparser<'a, 'b, 'c> {
|
||||
.fmt(self.f)?
|
||||
}
|
||||
Expr::NumberLiteral(ruff::ExprNumberLiteral { value, .. }) => {
|
||||
const { assert!(f64::MAX_10_EXP == 308) };
|
||||
#[allow(clippy::correctness, clippy::assertions_on_constants)]
|
||||
const {
|
||||
assert!(f64::MAX_10_EXP == 308)
|
||||
};
|
||||
|
||||
let inf_str = "1e309";
|
||||
match value {
|
||||
ruff::Number::Int(int) => int.fmt(self.f)?,
|
||||
|
||||
@@ -508,7 +508,7 @@ mod _contextvars {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ mod _contextvars {
|
||||
Err(vm.new_runtime_error("Tokens can only be created by ContextVars"))
|
||||
}
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4116,7 +4116,7 @@ mod _ssl {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,6 @@ use crate::{
|
||||
class::PyClassImpl,
|
||||
convert::{IntoPyException, ToPyObject, ToPyResult},
|
||||
function::{FuncArgs, OptionalArg},
|
||||
identifier,
|
||||
protocol::PyNumberMethods,
|
||||
types::{AsNumber, Constructor, Representable},
|
||||
};
|
||||
@@ -115,7 +114,7 @@ impl Constructor for PyBool {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ impl Constructor for PyClassMethod {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ use crate::{
|
||||
PyArithmeticValue::{self, *},
|
||||
PyComparisonValue,
|
||||
},
|
||||
identifier,
|
||||
protocol::PyNumberMethods,
|
||||
stdlib::warnings,
|
||||
types::{AsNumber, Comparable, Constructor, Hashable, PyComparisonOp, Representable},
|
||||
|
||||
@@ -244,7 +244,7 @@ impl Constructor for PyInt {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ impl Constructor for PyBaseObject {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ impl Constructor for PyStaticMethod {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ use crate::{
|
||||
},
|
||||
convert::ToPyResult,
|
||||
function::{FuncArgs, KwArgs, OptionalArg, PyMethodDef, PySetterValue},
|
||||
identifier,
|
||||
object::{Traverse, TraverseFn},
|
||||
protocol::{PyIterReturn, PyMappingMethods, PyNumberMethods, PySequenceMethods},
|
||||
types::{
|
||||
@@ -1289,7 +1288,7 @@ impl Constructor for PyType {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ impl Constructor for PyWeak {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
use crate::{
|
||||
builtins::{PyBaseObject, PyType, PyTypeRef},
|
||||
function::PyMethodDef,
|
||||
identifier,
|
||||
object::Py,
|
||||
types::{PyTypeFlags, PyTypeSlots, hash_not_implemented},
|
||||
vm::Context,
|
||||
|
||||
@@ -717,7 +717,7 @@ impl Constructor for PyBaseException {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: FuncArgs, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ use crate::{
|
||||
AsObject, PyObject, PyObjectRef, PyPayload, PyResult, TryFromObject, VirtualMachine,
|
||||
builtins::{PyDict, PyDictRef, iter::PySequenceIterator},
|
||||
convert::ToPyObject,
|
||||
identifier,
|
||||
object::{Traverse, TraverseFn},
|
||||
protocol::{PyIter, PyIterIter, PyMapping, PyMappingMethods},
|
||||
types::{AsMapping, GenericMethod},
|
||||
|
||||
@@ -77,7 +77,7 @@ pub(crate) mod _ast {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ impl Constructor for PyCArrayType {
|
||||
type Args = PyObjectRef;
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ impl Constructor for PyCArray {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -662,7 +662,7 @@ impl Constructor for PyCSimple {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -330,7 +330,7 @@ impl Constructor for PyCFuncPtr {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ impl Constructor for PyCPointer {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ impl Constructor for PyCStructType {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -332,7 +332,7 @@ impl Constructor for PyCStructure {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ impl Constructor for PyCUnionType {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,7 +191,7 @@ impl Constructor for PyCUnion {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ mod decl {
|
||||
},
|
||||
convert::ToPyObject,
|
||||
function::{ArgCallable, ArgIntoBool, FuncArgs, OptionalArg, OptionalOption, PosArgs},
|
||||
identifier,
|
||||
protocol::{PyIter, PyIterReturn, PyNumber},
|
||||
raise_if_stop,
|
||||
stdlib::{sys, warnings},
|
||||
@@ -1256,7 +1255,7 @@ mod decl {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ mod _operator {
|
||||
builtins::{PyInt, PyIntRef, PyStr, PyStrRef, PyTupleRef, PyType, PyTypeRef},
|
||||
common::wtf8::Wtf8,
|
||||
function::{ArgBytesLike, Either, FuncArgs, KwArgs, OptionalArg},
|
||||
identifier,
|
||||
protocol::PyIter,
|
||||
recursion::ReprGuard,
|
||||
types::{Callable, Constructor, PyComparisonOp, Representable},
|
||||
|
||||
@@ -1506,7 +1506,9 @@ pub(super) mod _os {
|
||||
#[cfg(target_os = "linux")]
|
||||
#[pyfunction]
|
||||
fn copy_file_range(args: CopyFileRangeArgs<'_>, vm: &VirtualMachine) -> PyResult<usize> {
|
||||
#[allow(clippy::unnecessary_option_map_or_else)]
|
||||
let p_offset_src = args.offset_src.as_ref().map_or_else(std::ptr::null, |x| x);
|
||||
#[allow(clippy::unnecessary_option_map_or_else)]
|
||||
let p_offset_dst = args.offset_dst.as_ref().map_or_else(std::ptr::null, |x| x);
|
||||
let count: usize = args
|
||||
.count
|
||||
|
||||
@@ -610,7 +610,7 @@ impl Constructor for ParamSpec {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -772,7 +772,7 @@ impl Constructor for TypeVarTuple {
|
||||
}
|
||||
|
||||
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
|
||||
unreachable!("use slot_new")
|
||||
unimplemented!("use slot_new")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ use crate::{
|
||||
function::{
|
||||
Either, FromArgs, FuncArgs, OptionalArg, PyComparisonValue, PyMethodDef, PySetterValue,
|
||||
},
|
||||
identifier,
|
||||
protocol::{
|
||||
PyBuffer, PyIterReturn, PyMapping, PyMappingMethods, PyNumber, PyNumberMethods,
|
||||
PyNumberSlots, PySequence, PySequenceMethods,
|
||||
|
||||
@@ -2,7 +2,6 @@ use super::PyMethod;
|
||||
use crate::{
|
||||
builtins::{PyBaseExceptionRef, PyList, PyStrInterned, pystr::AsPyStr},
|
||||
function::IntoFuncArgs,
|
||||
identifier,
|
||||
object::{AsObject, PyObject, PyObjectRef, PyResult},
|
||||
stdlib::sys,
|
||||
vm::VirtualMachine,
|
||||
|
||||
Reference in new issue
Block a user