Skip to content

Commit f33f337

Browse files
committed
Fix more linter errors
1 parent d65c4bd commit f33f337

File tree

7 files changed

+29
-17
lines changed

7 files changed

+29
-17
lines changed

bindings/dd/register_dd_package.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ void registerDDPackage(const nb::module_& m) {
164164
dd.def(
165165
"from_vector",
166166
[](dd::Package& p, const Vector& v) {
167-
const auto length = static_cast<size_t>(v.shape(0));
167+
const auto length = v.shape(0);
168168
if (length == 0) {
169169
return dd::vEdge::one();
170170
}
@@ -351,8 +351,8 @@ void registerDDPackage(const nb::module_& m) {
351351
dd.def(
352352
"from_matrix",
353353
[](dd::Package& p, const Matrix& m) {
354-
const auto rows = static_cast<size_t>(m.shape(0));
355-
const auto cols = static_cast<size_t>(m.shape(1));
354+
const auto rows = m.shape(0);
355+
const auto cols = m.shape(1);
356356
if (rows != cols) {
357357
throw std::invalid_argument("Matrix must be square.");
358358
}

bindings/dd/register_vector_dds.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include <nanobind/stl/complex.h> // NOLINT(misc-include-cleaner)
2323
#include <nanobind/stl/string.h> // NOLINT(misc-include-cleaner)
2424
#include <nanobind/stl/vector.h> // NOLINT(misc-include-cleaner)
25+
#include <ranges>
2526
#include <sstream>
2627
#include <string>
2728

bindings/fomac/fomac.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <optional>
2424
#include <qdmi/client.h>
2525
#include <string>
26+
#include <utility>
2627
#include <vector>
2728

2829
namespace mqt {
@@ -45,9 +46,17 @@ NB_MODULE(MQT_CORE_MODULE_NAME, m) {
4546
std::optional<std::string> custom1, std::optional<std::string> custom2,
4647
std::optional<std::string> custom3, std::optional<std::string> custom4,
4748
std::optional<std::string> custom5) {
48-
fomac::SessionConfig config{token, authFile, authUrl, username,
49-
password, projectId, custom1, custom2,
50-
custom3, custom4, custom5};
49+
const fomac::SessionConfig config{.token = std::move(token),
50+
.authFile = std::move(authFile),
51+
.authUrl = std::move(authUrl),
52+
.username = std::move(username),
53+
.password = std::move(password),
54+
.projectId = std::move(projectId),
55+
.custom1 = std::move(custom1),
56+
.custom2 = std::move(custom2),
57+
.custom3 = std::move(custom3),
58+
.custom4 = std::move(custom4),
59+
.custom5 = std::move(custom5)};
5160
new (self) fomac::Session(config);
5261
},
5362
"token"_a = std::nullopt, "auth_file"_a = std::nullopt,

bindings/ir/operations/register_compound_operation.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ void registerCompoundOperation(const nb::module_& m) {
7070
auto [start, stop, step, sliceLength] = slice.compute(op.size());
7171
auto ops = std::vector<qc::Operation*>();
7272
ops.reserve(sliceLength);
73-
for (std::size_t i = start; i < stop; i += step) {
73+
for (std::size_t i = start; std::cmp_less(i, stop);
74+
i += static_cast<std::size_t>(step)) {
7475
ops.emplace_back(op.at(i).get());
7576
}
7677
return ops;
@@ -95,7 +96,7 @@ void registerCompoundOperation(const nb::module_& m) {
9596
"Length of slice and number of operations do not match.");
9697
}
9798
for (std::size_t i = 0; i < sliceLength; ++i) {
98-
compOp[start] = ops[i]->clone();
99+
compOp[static_cast<std::size_t>(start)] = ops[i]->clone();
99100
start += step;
100101
}
101102
},
@@ -113,8 +114,8 @@ void registerCompoundOperation(const nb::module_& m) {
113114
auto [start, stop, step, sliceLength] = slice.compute(op.size());
114115
// delete in reverse order to not invalidate indices
115116
for (std::size_t i = sliceLength; i > 0; --i) {
116-
op.erase(op.begin() +
117-
static_cast<int64_t>(start + ((i - 1) * step)));
117+
op.erase(op.begin() + static_cast<std::size_t>(start) +
118+
((i - 1) * static_cast<std::size_t>(step)));
118119
}
119120
},
120121
"index"_a)

bindings/ir/register_permutation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
#include "ir/operations/Control.hpp"
1414

1515
#include <iterator>
16-
#include <memory>
1716
#include <nanobind/make_iterator.h>
1817
#include <nanobind/nanobind.h>
1918
#include <nanobind/operators.h>
2019
#include <nanobind/stl/string.h> // NOLINT(misc-include-cleaner)
2120
#include <sstream>
21+
#include <utility>
2222

2323
namespace mqt {
2424

bindings/ir/register_quantum_computation.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@ void registerQuantumComputation(nb::module_& m) {
104104
auto [start, stop, step, sliceLength] = slice.compute(circ.getNops());
105105
auto ops = std::vector<qc::Operation*>();
106106
ops.reserve(sliceLength);
107-
for (std::size_t i = start; i < stop; i += step) {
107+
for (size_t i = start; std::cmp_less(i, stop);
108+
i += static_cast<size_t>(step)) {
108109
ops.emplace_back(circ.at(i).get());
109110
}
110111
return ops;
@@ -128,7 +129,7 @@ void registerQuantumComputation(nb::module_& m) {
128129
"Length of slice and number of operations do not match.");
129130
}
130131
for (std::size_t i = 0; i < sliceLength; ++i) {
131-
circ.at(start) = ops[i]->clone();
132+
circ.at(static_cast<std::size_t>(start)) = ops[i]->clone();
132133
start += step;
133134
}
134135
},
@@ -146,8 +147,8 @@ void registerQuantumComputation(nb::module_& m) {
146147
auto [start, stop, step, sliceLength] = slice.compute(circ.getNops());
147148
// delete in reverse order to not invalidate indices
148149
for (std::size_t i = sliceLength; i > 0; --i) {
149-
circ.erase(circ.begin() +
150-
static_cast<int64_t>(start + ((i - 1) * step)));
150+
circ.erase(circ.begin() + static_cast<std::size_t>(start) +
151+
((i - 1) * static_cast<std::size_t>(step)));
151152
}
152153
},
153154
"index"_a);

bindings/ir/symbolic/register_variable.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void registerVariable(nb::module_& m) {
3030
.def(nb::self == nb::self) // NOLINT(misc-redundant-expression)
3131
.def(nb::self != nb::self) // NOLINT(misc-redundant-expression)
3232
.def(nb::hash(nb::self))
33-
.def(nb::self < nb::self)
34-
.def(nb::self > nb::self);
33+
.def(nb::self < nb::self) // NOLINT(misc-redundant-expression)
34+
.def(nb::self > nb::self); // NOLINT(misc-redundant-expression)
3535
}
3636
} // namespace mqt

0 commit comments

Comments
 (0)