mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
clippy: Fix several warnings (#31710)
Signed-off-by: RustAndMetal <111676747+RustAndMetal@users.noreply.github.com>
This commit is contained in:
parent
1ab8fa2895
commit
f6a975fc58
23 changed files with 75 additions and 86 deletions
|
@ -6,8 +6,8 @@
|
|||
macro_rules! make_getter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self) -> DOMString {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
element.get_string_attribute(&html5ever::local_name!($htmlname))
|
||||
}
|
||||
|
@ -18,8 +18,8 @@ macro_rules! make_getter(
|
|||
macro_rules! make_bool_getter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self) -> bool {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
element.has_attribute(&html5ever::local_name!($htmlname))
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ macro_rules! make_bool_getter(
|
|||
macro_rules! make_limited_int_setter(
|
||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||
fn $attr(&self, value: i32) -> $crate::dom::bindings::error::ErrorResult {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
|
||||
let value = if value < 0 {
|
||||
return Err($crate::dom::bindings::error::Error::IndexSize);
|
||||
|
@ -50,8 +50,8 @@ macro_rules! make_limited_int_setter(
|
|||
macro_rules! make_int_setter(
|
||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||
fn $attr(&self, value: i32) {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
|
||||
let element = self.upcast::<Element>();
|
||||
element.set_int_attribute(&html5ever::local_name!($htmlname), value)
|
||||
|
@ -66,8 +66,8 @@ macro_rules! make_int_setter(
|
|||
macro_rules! make_int_getter(
|
||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||
fn $attr(&self) -> i32 {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
element.get_int_attribute(&html5ever::local_name!($htmlname), $default)
|
||||
}
|
||||
|
@ -82,8 +82,8 @@ macro_rules! make_int_getter(
|
|||
macro_rules! make_uint_getter(
|
||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||
fn $attr(&self) -> u32 {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
element.get_uint_attribute(&html5ever::local_name!($htmlname), $default)
|
||||
}
|
||||
|
@ -97,8 +97,8 @@ macro_rules! make_uint_getter(
|
|||
macro_rules! make_url_getter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self) -> USVString {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
element.get_url_attribute(&html5ever::local_name!($htmlname))
|
||||
}
|
||||
|
@ -109,8 +109,8 @@ macro_rules! make_url_getter(
|
|||
macro_rules! make_url_setter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self, value: USVString) {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
element.set_url_attribute(&html5ever::local_name!($htmlname),
|
||||
value);
|
||||
|
@ -122,8 +122,8 @@ macro_rules! make_url_setter(
|
|||
macro_rules! make_form_action_getter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self) -> DOMString {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
let doc = crate::dom::node::document_from_node(self);
|
||||
let attr = element.get_attribute(&html5ever::ns!(), &html5ever::local_name!($htmlname));
|
||||
|
@ -144,8 +144,8 @@ macro_rules! make_form_action_getter(
|
|||
macro_rules! make_labels_getter(
|
||||
( $attr:ident, $memo:ident ) => (
|
||||
fn $attr(&self) -> DomRoot<NodeList> {
|
||||
use crate::dom::htmlelement::HTMLElement;
|
||||
use crate::dom::nodelist::NodeList;
|
||||
use $crate::dom::htmlelement::HTMLElement;
|
||||
use $crate::dom::nodelist::NodeList;
|
||||
self.$memo.or_init(|| NodeList::new_labels_list(
|
||||
self.upcast::<Node>().owner_doc().window(),
|
||||
self.upcast::<HTMLElement>()
|
||||
|
@ -159,8 +159,8 @@ macro_rules! make_labels_getter(
|
|||
macro_rules! make_enumerated_getter(
|
||||
( $attr:ident, $htmlname:tt, $default:expr, $($choices: pat)|+) => (
|
||||
fn $attr(&self) -> DOMString {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
let mut val = element.get_string_attribute(&html5ever::local_name!($htmlname));
|
||||
val.make_ascii_lowercase();
|
||||
|
@ -179,8 +179,8 @@ macro_rules! make_enumerated_getter(
|
|||
macro_rules! make_setter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self, value: DOMString) {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
element.set_string_attribute(&html5ever::local_name!($htmlname), value)
|
||||
}
|
||||
|
@ -191,8 +191,8 @@ macro_rules! make_setter(
|
|||
macro_rules! make_bool_setter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self, value: bool) {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
element.set_bool_attribute(&html5ever::local_name!($htmlname), value)
|
||||
}
|
||||
|
@ -203,8 +203,8 @@ macro_rules! make_bool_setter(
|
|||
macro_rules! make_uint_setter(
|
||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||
fn $attr(&self, value: u32) {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
use crate::dom::values::UNSIGNED_LONG_MAX;
|
||||
let value = if value > UNSIGNED_LONG_MAX {
|
||||
$default
|
||||
|
@ -224,8 +224,8 @@ macro_rules! make_uint_setter(
|
|||
macro_rules! make_limited_uint_setter(
|
||||
($attr:ident, $htmlname:tt, $default:expr) => (
|
||||
fn $attr(&self, value: u32) -> $crate::dom::bindings::error::ErrorResult {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
use crate::dom::values::UNSIGNED_LONG_MAX;
|
||||
let value = if value == 0 {
|
||||
return Err($crate::dom::bindings::error::Error::IndexSize);
|
||||
|
@ -248,8 +248,8 @@ macro_rules! make_limited_uint_setter(
|
|||
macro_rules! make_atomic_setter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self, value: DOMString) {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
element.set_atomic_attribute(&html5ever::local_name!($htmlname), value)
|
||||
}
|
||||
|
@ -260,8 +260,8 @@ macro_rules! make_atomic_setter(
|
|||
macro_rules! make_legacy_color_setter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self, value: DOMString) {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
use style::attr::AttrValue;
|
||||
let element = self.upcast::<Element>();
|
||||
let value = AttrValue::from_legacy_color(value.into());
|
||||
|
@ -274,8 +274,8 @@ macro_rules! make_legacy_color_setter(
|
|||
macro_rules! make_dimension_setter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self, value: DOMString) {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
let value = AttrValue::from_dimension(value.into());
|
||||
element.set_attribute(&html5ever::local_name!($htmlname), value)
|
||||
|
@ -287,8 +287,8 @@ macro_rules! make_dimension_setter(
|
|||
macro_rules! make_nonzero_dimension_setter(
|
||||
( $attr:ident, $htmlname:tt ) => (
|
||||
fn $attr(&self, value: DOMString) {
|
||||
use crate::dom::bindings::inheritance::Castable;
|
||||
use crate::dom::element::Element;
|
||||
use $crate::dom::bindings::inheritance::Castable;
|
||||
use $crate::dom::element::Element;
|
||||
let element = self.upcast::<Element>();
|
||||
let value = AttrValue::from_nonzero_dimension(value.into());
|
||||
element.set_attribute(&html5ever::local_name!($htmlname), value)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue