Skip to content

Commit bfd873a

Browse files
authored
a few unreachable->unimplemented, clippy (RustPython#6405)
* unreachable -> unimplemented * Fix clippy on 1.92
1 parent f379ea8 commit bfd873a

27 files changed

Lines changed: 31 additions & 34 deletions

crates/codegen/src/unparse.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,11 @@ impl<'a, 'b, 'c> Unparser<'a, 'b, 'c> {
380380
.fmt(self.f)?
381381
}
382382
Expr::NumberLiteral(ruff::ExprNumberLiteral { value, .. }) => {
383-
const { assert!(f64::MAX_10_EXP == 308) };
383+
#[allow(clippy::correctness, clippy::assertions_on_constants)]
384+
const {
385+
assert!(f64::MAX_10_EXP == 308)
386+
};
387+
384388
let inf_str = "1e309";
385389
match value {
386390
ruff::Number::Int(int) => int.fmt(self.f)?,

crates/stdlib/src/contextvars.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -508,7 +508,7 @@ mod _contextvars {
508508
}
509509

510510
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
511-
unreachable!("use slot_new")
511+
unimplemented!("use slot_new")
512512
}
513513
}
514514

@@ -585,7 +585,7 @@ mod _contextvars {
585585
Err(vm.new_runtime_error("Tokens can only be created by ContextVars"))
586586
}
587587
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
588-
unreachable!("use slot_new")
588+
unimplemented!("use slot_new")
589589
}
590590
}
591591

crates/stdlib/src/ssl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4116,7 +4116,7 @@ mod _ssl {
41164116
}
41174117

41184118
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
4119-
unreachable!("use slot_new")
4119+
unimplemented!("use slot_new")
41204120
}
41214121
}
41224122

crates/vm/src/builtins/bool.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use crate::{
66
class::PyClassImpl,
77
convert::{IntoPyException, ToPyObject, ToPyResult},
88
function::{FuncArgs, OptionalArg},
9-
identifier,
109
protocol::PyNumberMethods,
1110
types::{AsNumber, Constructor, Representable},
1211
};
@@ -115,7 +114,7 @@ impl Constructor for PyBool {
115114
}
116115

117116
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
118-
unreachable!("use slot_new")
117+
unimplemented!("use slot_new")
119118
}
120119
}
121120

crates/vm/src/builtins/classmethod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl Constructor for PyClassMethod {
103103
}
104104

105105
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
106-
unreachable!("use slot_new")
106+
unimplemented!("use slot_new")
107107
}
108108
}
109109

crates/vm/src/builtins/complex.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use crate::{
1010
PyArithmeticValue::{self, *},
1111
PyComparisonValue,
1212
},
13-
identifier,
1413
protocol::PyNumberMethods,
1514
stdlib::warnings,
1615
types::{AsNumber, Comparable, Constructor, Hashable, PyComparisonOp, Representable},

crates/vm/src/builtins/int.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ impl Constructor for PyInt {
244244
}
245245

246246
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
247-
unreachable!("use slot_new")
247+
unimplemented!("use slot_new")
248248
}
249249
}
250250

crates/vm/src/builtins/object.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl Constructor for PyBaseObject {
111111
}
112112

113113
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
114-
unreachable!("use slot_new")
114+
unimplemented!("use slot_new")
115115
}
116116
}
117117

crates/vm/src/builtins/staticmethod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ impl Constructor for PyStaticMethod {
6161
}
6262

6363
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
64-
unreachable!("use slot_new")
64+
unimplemented!("use slot_new")
6565
}
6666
}
6767

crates/vm/src/builtins/type.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ use crate::{
2222
},
2323
convert::ToPyResult,
2424
function::{FuncArgs, KwArgs, OptionalArg, PyMethodDef, PySetterValue},
25-
identifier,
2625
object::{Traverse, TraverseFn},
2726
protocol::{PyIterReturn, PyMappingMethods, PyNumberMethods, PySequenceMethods},
2827
types::{
@@ -1289,7 +1288,7 @@ impl Constructor for PyType {
12891288
}
12901289

12911290
fn py_new(_cls: &Py<PyType>, _args: Self::Args, _vm: &VirtualMachine) -> PyResult<Self> {
1292-
unreachable!("use slot_new")
1291+
unimplemented!("use slot_new")
12931292
}
12941293
}
12951294

0 commit comments

Comments
 (0)