Everywhere: Use AK_MAKE_DEFAULT_MOVABLE to avoid mistakes

This commit is contained in:
Ben Wiederhake 2023-06-16 16:16:16 +02:00 committed by Sam Atkins
parent 2ebd79bc76
commit 0184fc5e43
4 changed files with 14 additions and 22 deletions

View file

@ -202,11 +202,9 @@ constexpr double const middle_c = note_frequencies[36];
struct Signal : public Variant<FixedArray<Sample>, RollNotes> {
using Variant::Variant;
AK_MAKE_NONCOPYABLE(Signal);
AK_MAKE_DEFAULT_MOVABLE(Signal);
public:
Signal& operator=(Signal&&) = default;
Signal(Signal&&) = default;
ALWAYS_INLINE SignalType type() const
{
if (has<FixedArray<Sample>>())

View file

@ -75,6 +75,9 @@ enum class SQLErrorCode {
};
class [[nodiscard]] Result {
AK_MAKE_NONCOPYABLE(Result);
AK_MAKE_DEFAULT_MOVABLE(Result);
public:
ALWAYS_INLINE Result(SQLCommand command)
: m_command(command)
@ -100,9 +103,6 @@ public:
{
}
Result(Result&&) = default;
Result& operator=(Result&&) = default;
SQLCommand command() const { return m_command; }
SQLErrorCode error() const { return m_error; }
DeprecatedString error_string() const;
@ -120,8 +120,6 @@ public:
}
private:
AK_MAKE_NONCOPYABLE(Result);
SQLCommand m_command { SQLCommand::Unknown };
SQLErrorCode m_error { SQLErrorCode::NoError };

View file

@ -21,6 +21,7 @@ class HTMLTokenizer;
class HTMLToken {
AK_MAKE_NONCOPYABLE(HTMLToken);
AK_MAKE_DEFAULT_MOVABLE(HTMLToken);
public:
enum class Type : u8 {
@ -95,9 +96,6 @@ public:
}
}
HTMLToken(HTMLToken&&) = default;
HTMLToken& operator=(HTMLToken&&) = default;
bool is_doctype() const { return m_type == Type::DOCTYPE; }
bool is_start_tag() const { return m_type == Type::StartTag; }
bool is_end_tag() const { return m_type == Type::EndTag; }

View file

@ -612,14 +612,7 @@ enum class CycleDecision {
// In most cases, just an input to sed. However, files are also written to when the -i option is used.
class File {
AK_MAKE_NONCOPYABLE(File);
File(LexicalPath input_file_path, NonnullOwnPtr<Core::InputBufferedFile>&& file, OwnPtr<Core::File>&& output, OwnPtr<FileSystem::TempFile>&& temp_file)
: m_input_file_path(move(input_file_path))
, m_file(move(file))
, m_output(move(output))
, m_output_temp_file(move(temp_file))
{
}
AK_MAKE_DEFAULT_MOVABLE(File);
public:
// Used for -i mode.
@ -656,9 +649,6 @@ public:
};
}
File(File&&) = default;
File& operator=(File&&) = default;
ErrorOr<bool> has_next() const
{
return m_file->can_read_line();
@ -696,6 +686,14 @@ public:
}
private:
File(LexicalPath input_file_path, NonnullOwnPtr<Core::InputBufferedFile>&& file, OwnPtr<Core::File>&& output, OwnPtr<FileSystem::TempFile>&& temp_file)
: m_input_file_path(move(input_file_path))
, m_file(move(file))
, m_output(move(output))
, m_output_temp_file(move(temp_file))
{
}
LexicalPath m_input_file_path;
NonnullOwnPtr<Core::InputBufferedFile> m_file;