Base: Do not use else before return
This commit is contained in:
@@ -175,10 +175,8 @@ PyObject* UnitPy::number_multiply_handler(PyObject* self, PyObject* other)
|
||||
|
||||
return new UnitPy(new Unit((*a) * (*b)));
|
||||
}
|
||||
else {
|
||||
PyErr_SetString(PyExc_TypeError, "A Unit can only be multiplied by a Unit");
|
||||
return nullptr;
|
||||
}
|
||||
PyErr_SetString(PyExc_TypeError, "A Unit can only be multiplied by a Unit");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject* UnitPy::richCompare(PyObject* v, PyObject* w, int op)
|
||||
@@ -192,22 +190,18 @@ PyObject* UnitPy::richCompare(PyObject* v, PyObject* w, int op)
|
||||
PyErr_SetString(PyExc_TypeError, "no ordering relation is defined for Units");
|
||||
return nullptr;
|
||||
}
|
||||
else if (op == Py_EQ) {
|
||||
if (op == Py_EQ) {
|
||||
res = (*u1 == *u2) ? Py_True : Py_False; // NOLINT
|
||||
Py_INCREF(res);
|
||||
return res;
|
||||
}
|
||||
else {
|
||||
res = (*u1 != *u2) ? Py_True : Py_False; // NOLINT
|
||||
Py_INCREF(res);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// This always returns False
|
||||
Py_INCREF(Py_NotImplemented);
|
||||
return Py_NotImplemented;
|
||||
res = (*u1 != *u2) ? Py_True : Py_False; // NOLINT
|
||||
Py_INCREF(res);
|
||||
return res;
|
||||
}
|
||||
// This always returns False
|
||||
Py_INCREF(Py_NotImplemented);
|
||||
return Py_NotImplemented;
|
||||
}
|
||||
|
||||
Py::String UnitPy::getType() const
|
||||
|
||||
Reference in New Issue
Block a user