Jelajahi Sumber

LibWeb: Use default instead of an empty constructor/destructor

Default implementations allow for more optimizations.
See: https://pvs-studio.com/en/docs/warnings/v832/
Brian Gianforcaro 3 tahun lalu
induk
melakukan
2b57018196

+ 1 - 1
Userland/Libraries/LibWeb/CSS/Length.h

@@ -35,7 +35,7 @@ public:
         Vmin,
         Vmin,
     };
     };
 
 
-    Length() { }
+    Length() = default;
     Length(int value, Type type)
     Length(int value, Type type)
         : m_type(type)
         : m_type(type)
         , m_value(value)
         , m_value(value)

+ 0 - 4
Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp

@@ -31,10 +31,6 @@ static void log_parse_error(const SourceLocation& location = SourceLocation::cur
 
 
 namespace Web::CSS {
 namespace Web::CSS {
 
 
-ParsingContext::ParsingContext()
-{
-}
-
 ParsingContext::ParsingContext(DOM::Document& document)
 ParsingContext::ParsingContext(DOM::Document& document)
     : m_document(&document)
     : m_document(&document)
 {
 {

+ 1 - 1
Userland/Libraries/LibWeb/CSS/Parser/Parser.h

@@ -32,7 +32,7 @@ enum class PropertyID;
 
 
 class ParsingContext {
 class ParsingContext {
 public:
 public:
-    ParsingContext();
+    ParsingContext() = default;
     explicit ParsingContext(DOM::Document&);
     explicit ParsingContext(DOM::Document&);
     explicit ParsingContext(DOM::ParentNode&);
     explicit ParsingContext(DOM::ParentNode&);
 
 

+ 1 - 1
Userland/Libraries/LibWeb/DOM/NonDocumentTypeChildNode.h

@@ -47,7 +47,7 @@ public:
     const Element* next_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_in_pre_order(); }
     const Element* next_element_in_pre_order() const { return const_cast<NonDocumentTypeChildNode*>(this)->next_element_in_pre_order(); }
 
 
 protected:
 protected:
-    NonDocumentTypeChildNode() { }
+    NonDocumentTypeChildNode() = default;
 };
 };
 
 
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/DOM/NonElementParentNode.h

@@ -34,7 +34,7 @@ public:
     }
     }
 
 
 protected:
 protected:
-    NonElementParentNode() { }
+    NonElementParentNode() = default;
 };
 };
 
 
 }
 }

+ 1 - 1
Userland/Libraries/LibWeb/TreeNode.h

@@ -419,7 +419,7 @@ public:
     }
     }
 
 
 protected:
 protected:
-    TreeNode() { }
+    TreeNode() = default;
 
 
     bool m_deletion_has_begun { false };
     bool m_deletion_has_begun { false };
     bool m_in_removed_last_ref { false };
     bool m_in_removed_last_ref { false };