Skip to content

Commit d80165d

Browse files
committed
Rename constant to increase readability
1 parent e4646ba commit d80165d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/array_like.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::array::PyArrayMethods;
1313
use crate::{get_array_module, Element, IntoPyArray, PyArray, PyReadonlyArray};
1414

1515
pub trait Coerce: Sealed {
16-
const VAL: bool;
16+
const ALLOW_TYPE_CHANGE: bool;
1717
}
1818

1919
mod sealed {
@@ -29,7 +29,7 @@ pub struct TypeMustMatch;
2929
impl Sealed for TypeMustMatch {}
3030

3131
impl Coerce for TypeMustMatch {
32-
const VAL: bool = false;
32+
const ALLOW_TYPE_CHANGE: bool = false;
3333
}
3434

3535
/// Marker type to indicate that the element type received via [`PyArrayLike`] can be cast to the specified type by NumPy's [`asarray`](https://numpy.org/doc/stable/reference/generated/numpy.asarray.html).
@@ -39,7 +39,7 @@ pub struct AllowTypeChange;
3939
impl Sealed for AllowTypeChange {}
4040

4141
impl Coerce for AllowTypeChange {
42-
const VAL: bool = true;
42+
const ALLOW_TYPE_CHANGE: bool = true;
4343
}
4444

4545
trait IsNumpyNDArray {
@@ -172,7 +172,7 @@ where
172172

173173
// If the input is already an ndarray and `TypeMustMatch` is used then any conversion
174174
// should be performed.
175-
if (C::VAL || !ob.is_numpy_ndarray()?) && matches!(D::NDIM, None | Some(1)) {
175+
if (C::ALLOW_TYPE_CHANGE || !ob.is_numpy_ndarray()?) && matches!(D::NDIM, None | Some(1)) {
176176
if let Ok(vec) = ob.extract::<Vec<T>>() {
177177
let array = Array1::from(vec)
178178
.into_dimensionality()
@@ -191,7 +191,7 @@ where
191191
})?
192192
.bind(py);
193193

194-
let kwargs = if C::VAL {
194+
let kwargs = if C::ALLOW_TYPE_CHANGE {
195195
let kwargs = PyDict::new(py);
196196
kwargs.set_item(intern!(py, "dtype"), T::get_dtype(py))?;
197197
Some(kwargs)

0 commit comments

Comments
 (0)