LibWeb: Use "= default" to declare empty constructors and descructors

A types which have special functions declared with "= default can be
trivially copied. Besides being good practice, the compiler might be
able generate copy and initialize code in a more optimized way.

Found By PVS-Studio: https://pvs-studio.com/en/docs/warnings/v832/
This commit is contained in:
Brian Gianforcaro 2021-10-10 00:06:13 -07:00 committed by Andreas Kling
parent 027cbe6b89
commit 6781d60e3a
Notes: sideshowbarker 2024-07-18 02:51:33 +09:00
2 changed files with 3 additions and 3 deletions
Userland/Libraries/LibWeb

View file

@ -20,7 +20,7 @@ class MediaQuery : public RefCounted<MediaQuery> {
friend class Parser;
public:
~MediaQuery() { }
~MediaQuery() = default;
// https://www.w3.org/TR/mediaqueries-4/#media-types
enum class MediaType {
@ -82,7 +82,7 @@ public:
String to_string() const;
private:
MediaQuery() { }
MediaQuery() = default;
// https://www.w3.org/TR/mediaqueries-4/#mq-not
bool m_negated { false };

View file

@ -31,7 +31,7 @@ public:
, m_handler(move(handler))
{
}
~RequestAnimationFrameCallback() { }
~RequestAnimationFrameCallback() = default;
i32 id() const { return m_id; }
bool is_cancelled() const { return !m_handler; }