FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

a few unreachable->unimplemented, clippy by youknowone · Pull Request #6405 · RustPython/RustPython · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .rs  (27) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
6 changes: 5 additions & 1 deletion crates/codegen/src/unparse.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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)?,
Expand Down
4 changes: 2 additions & 2 deletions crates/stdlib/src/contextvars.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/stdlib/src/ssl.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
3 changes: 1 addition & 2 deletions crates/vm/src/builtins/bool.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ use crate::{
class::PyClassImpl,
convert::{IntoPyException, ToPyObject, ToPyResult},
function::{FuncArgs, OptionalArg},
identifier,
protocol::PyNumberMethods,
types::{AsNumber, Constructor, Representable},
};
Expand Down Expand Up @@ -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")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/classmethod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/builtins/complex.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::{
PyArithmeticValue::{self, *},
PyComparisonValue,
},
identifier,
protocol::PyNumberMethods,
stdlib::warnings,
types::{AsNumber, Comparable, Constructor, Hashable, PyComparisonOp, Representable},
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/int.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/object.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/staticmethod.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
3 changes: 1 addition & 2 deletions crates/vm/src/builtins/type.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ use crate::{
},
convert::ToPyResult,
function::{FuncArgs, KwArgs, OptionalArg, PyMethodDef, PySetterValue},
identifier,
object::{Traverse, TraverseFn},
protocol::{PyIterReturn, PyMappingMethods, PyNumberMethods, PySequenceMethods},
types::{
Expand Down Expand Up @@ -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")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/builtins/weakref.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/class.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use crate::{
builtins::{PyBaseObject, PyType, PyTypeRef},
function::PyMethodDef,
identifier,
object::Py,
types::{PyTypeFlags, PyTypeSlots, hash_not_implemented},
vm::Context,
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/exceptions.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/function/protocol.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/ast/python.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/stdlib/ctypes/array.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/ctypes/base.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/ctypes/function.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/vm/src/stdlib/ctypes/pointer.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/stdlib/ctypes/structure.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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")
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/stdlib/ctypes/union.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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")
}
}

Expand Down
3 changes: 1 addition & 2 deletions crates/vm/src/stdlib/itertools.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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")
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/stdlib/operator.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down
2 changes: 2 additions & 0 deletions crates/vm/src/stdlib/os.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions crates/vm/src/stdlib/typevar.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
}

Expand Down Expand Up @@ -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")
}
}

Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/types/slot.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion crates/vm/src/vm/vm_object.rs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

Back | FazBrowse Home | New Git URL