Base: Do not use else before return

This commit is contained in:
Ladislav Michl
2023-11-15 10:12:42 +01:00
committed by 3x380V
parent 411b7573cc
commit 3a25a66a05
13 changed files with 115 additions and 176 deletions

View File

@@ -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