Skip to content

Commit

Permalink
🎨 pre-commit fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pre-commit-ci[bot] committed Sep 2, 2023
1 parent 2b5cb2f commit e02cc64
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 13 deletions.
2 changes: 1 addition & 1 deletion include/operations/CompoundOperation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ class CompoundOperation final : public Operation {
}

void invert() override {
for (auto &op : ops) {
for (auto& op : ops) {
op->invert();
}
std::reverse(ops.begin(), ops.end());
Expand Down
7 changes: 4 additions & 3 deletions include/parsers/qasm3_parser/Parser.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ class Parser {
std::stack<ScannerState> scanner{};
std::shared_ptr<DebugInfo> includeDebugInfo{nullptr};

[[noreturn]] static void error(const Token& token,
const std::string& msg) {
[[noreturn]] static void error(const Token& token, const std::string& msg) {
std::cerr << "Error at line " << token.line << ", column " << token.col
<< ": " << msg << '\n';
throw std::runtime_error("Parser error");
Expand All @@ -83,7 +82,9 @@ class Parser {

Token expect(const Token::Kind& expected) {
if (current().kind != expected) {
error(current(), "Expected '" + Token::kindToString(expected) + "', got '" + Token::kindToString(current().kind) + "'");
error(current(), "Expected '" + Token::kindToString(expected) +
"', got '" + Token::kindToString(current().kind) +
"'");
}

Token const token = current();
Expand Down
4 changes: 1 addition & 3 deletions include/parsers/qasm3_parser/Scanner.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ class Scanner {
return isalpha(c) != 0 || c == '_';
}

[[nodiscard]] static bool isNum(const char c) {
return isnumber(c) != 0;
}
[[nodiscard]] static bool isNum(const char c) { return isnumber(c) != 0; }

[[nodiscard]] static bool isHex(const char c) {
return isNum(c) || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
Expand Down
6 changes: 2 additions & 4 deletions include/parsers/qasm3_parser/Statement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,8 +276,7 @@ class GateOperand {
std::string identifier;
std::shared_ptr<Expression> expression;

GateOperand(std::string identifier,
std::shared_ptr<Expression> expression)
GateOperand(std::string identifier, std::shared_ptr<Expression> expression)
: identifier(std::move(identifier)), expression(std::move(expression)) {}
};

Expand All @@ -291,8 +290,7 @@ class DeclarationStatement
std::shared_ptr<DeclarationExpression> expression;

DeclarationStatement(std::shared_ptr<DebugInfo> debugInfo, bool isConst,
std::unique_ptr<Type> type,
std::string identifier,
std::unique_ptr<Type> type, std::string identifier,
std::shared_ptr<DeclarationExpression> expression)
: Statement(std::move(debugInfo)), isConst(isConst),
type(std::move(type)), identifier(std::move(identifier)),
Expand Down
2 changes: 1 addition & 1 deletion src/parsers/QASM3Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class OpenQasm3Parser : public InstVisitor {
};

[[noreturn]] static void error(const std::string& message,
const std::shared_ptr<DebugInfo>& debugInfo) {
const std::shared_ptr<DebugInfo>& debugInfo) {
throw CompilerError(message, debugInfo);
}

Expand Down
2 changes: 1 addition & 1 deletion test/unittests/test_qfr_functionality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1943,7 +1943,7 @@ TEST_F(QFRFunctionality, controlCompoundOperation) {
op.emplace_back<StandardOperation>(2, Targets{0}, OpType::H);
op.emplace_back<StandardOperation>(2, Targets{0}, OpType::X);

qc::Controls const controls { qc::Control{0, qc::Control::Type::Pos} };
qc::Controls const controls{qc::Control{0, qc::Control::Type::Pos}};
op.setControls(controls);

ASSERT_EQ(op.getOps()[0]->getControls(), controls);
Expand Down

0 comments on commit e02cc64

Please sign in to comment.