Skip to content

Commit 00bfc6b

Browse files
committed
Remove a lot of unused imports
1 parent 90bae7f commit 00bfc6b

23 files changed

+56
-122
lines changed

components/style/properties/helpers.mako.rs

+25-4
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
<%def name="predefined_type_inner(name, type, initial_value, parse_method)">
1414
#[allow(unused_imports)]
1515
use app_units::Au;
16+
#[allow(unused_imports)]
1617
use cssparser::{Color as CSSParserColor, RGBA};
18+
#[allow(unused_imports)]
1719
use values::specified::AllowQuirks;
20+
#[allow(unused_imports)]
1821
use smallvec::SmallVec;
1922
pub use values::specified::${type} as SpecifiedValue;
2023
pub mod computed_value {
@@ -78,15 +81,22 @@
7881
% if not gecko_only:
7982
use smallvec::SmallVec;
8083
use std::fmt;
84+
#[allow(unused_imports)]
8185
use values::HasViewportPercentage;
8286
use style_traits::ToCss;
8387

8488
pub mod single_value {
89+
#[allow(unused_imports)]
8590
use cssparser::Parser;
91+
#[allow(unused_imports)]
8692
use parser::{Parse, ParserContext};
93+
#[allow(unused_imports)]
8794
use properties::ShorthandId;
95+
#[allow(unused_imports)]
8896
use values::computed::{Context, ToComputedValue};
97+
#[allow(unused_imports)]
8998
use values::{computed, specified};
99+
#[allow(unused_imports)]
90100
use values::{Auto, Either, None_, Normal};
91101
${caller.body()}
92102
}
@@ -198,6 +208,7 @@
198208
}
199209

200210
pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
211+
#[allow(unused_imports)]
201212
use parser::parse_space_or_comma_separated;
202213

203214
<%
@@ -253,22 +264,35 @@
253264
%>
254265
/// ${property.spec}
255266
pub mod ${property.ident} {
256-
#![allow(unused_imports)]
257267
% if not property.derived_from:
268+
#[allow(unused_imports)]
258269
use cssparser::Parser;
270+
#[allow(unused_imports)]
259271
use parser::{Parse, ParserContext};
272+
#[allow(unused_imports)]
260273
use properties::{UnparsedValue, ShorthandId};
261274
% endif
275+
#[allow(unused_imports)]
262276
use values::{Auto, Either, None_, Normal};
277+
#[allow(unused_imports)]
263278
use cascade_info::CascadeInfo;
279+
#[allow(unused_imports)]
264280
use error_reporting::ParseErrorReporter;
281+
#[allow(unused_imports)]
265282
use properties::longhands;
283+
#[allow(unused_imports)]
266284
use properties::{DeclaredValue, LonghandId, LonghandIdSet};
285+
#[allow(unused_imports)]
267286
use properties::{CSSWideKeyword, ComputedValues, PropertyDeclaration};
287+
#[allow(unused_imports)]
268288
use properties::style_structs;
289+
#[allow(unused_imports)]
269290
use stylearc::Arc;
291+
#[allow(unused_imports)]
270292
use values::computed::{Context, ToComputedValue};
293+
#[allow(unused_imports)]
271294
use values::{computed, generics, specified};
295+
#[allow(unused_imports)]
272296
use Atom;
273297
${caller.body()}
274298
#[allow(unused_variables)]
@@ -454,7 +478,6 @@
454478
keyword = keyword=Keyword(name, values, **keyword_kwargs)
455479
%>
456480
<%call expr="longhand(name, keyword=Keyword(name, values, **keyword_kwargs), **kwargs)">
457-
use values::HasViewportPercentage;
458481
use properties::longhands::system_font::SystemFont;
459482
use std::fmt;
460483
use style_traits::ToCss;
@@ -576,7 +599,6 @@
576599
impl ComputedValueAsSpecified for SpecifiedValue {}
577600
% endif
578601

579-
use values::HasViewportPercentage;
580602
no_viewport_percentage!(SpecifiedValue);
581603
</%call>
582604
</%def>
@@ -738,7 +760,6 @@
738760
% if shorthand:
739761
/// ${shorthand.spec}
740762
pub mod ${shorthand.ident} {
741-
#[allow(unused_imports)]
742763
use cssparser::Parser;
743764
use parser::ParserContext;
744765
use properties::{PropertyDeclaration, ParsedDeclaration};

components/style/properties/longhand/background.mako.rs

-4
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ ${helpers.predefined_type("background-image", "ImageLayer",
3434
spec="https://drafts.csswg.org/css-backgrounds/#the-background-repeat">
3535
use std::fmt;
3636
use style_traits::ToCss;
37-
use values::HasViewportPercentage;
3837

3938
define_css_keyword_enum!(RepeatKeyword:
4039
"repeat" => Repeat,
@@ -163,11 +162,8 @@ ${helpers.single_keyword("background-origin",
163162

164163
<%helpers:vector_longhand name="background-size" animation_value_type="ComputedValue" extra_prefixes="webkit"
165164
spec="https://drafts.csswg.org/css-backgrounds/#the-background-size">
166-
use cssparser::Token;
167-
use std::ascii::AsciiExt;
168165
use std::fmt;
169166
use style_traits::ToCss;
170-
use values::HasViewportPercentage;
171167

172168
#[allow(missing_docs)]
173169
pub mod computed_value {

components/style/properties/longhand/border.mako.rs

-6
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ ${helpers.gecko_keyword_conversion(Keyword('border-style',
6262
products="gecko">
6363
use std::fmt;
6464
use style_traits::ToCss;
65-
use values::HasViewportPercentage;
6665
use values::specified::CSSColor;
6766
no_viewport_percentage!(SpecifiedValue);
6867

@@ -205,7 +204,6 @@ ${helpers.predefined_type("border-image-source", "ImageLayer",
205204
spec="https://drafts.csswg.org/css-backgrounds/#border-image-outset">
206205
use std::fmt;
207206
use style_traits::ToCss;
208-
use values::HasViewportPercentage;
209207
use values::specified::{LengthOrNumber, Number};
210208

211209
pub mod computed_value {
@@ -310,13 +308,11 @@ ${helpers.predefined_type("border-image-source", "ImageLayer",
310308
spec="https://drafts.csswg.org/css-backgrounds/#border-image-repeat">
311309
use std::fmt;
312310
use style_traits::ToCss;
313-
use values::HasViewportPercentage;
314311

315312
no_viewport_percentage!(SpecifiedValue);
316313

317314
pub mod computed_value {
318315
pub use super::RepeatKeyword;
319-
use values::computed;
320316

321317
#[derive(Debug, Clone, PartialEq)]
322318
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
@@ -388,7 +384,6 @@ ${helpers.predefined_type("border-image-source", "ImageLayer",
388384
spec="https://drafts.csswg.org/css-backgrounds/#border-image-width">
389385
use std::fmt;
390386
use style_traits::ToCss;
391-
use values::HasViewportPercentage;
392387
use values::specified::{LengthOrPercentage, Number};
393388

394389
pub mod computed_value {
@@ -574,7 +569,6 @@ ${helpers.predefined_type("border-image-source", "ImageLayer",
574569
spec="https://drafts.csswg.org/css-backgrounds/#border-image-slice">
575570
use std::fmt;
576571
use style_traits::ToCss;
577-
use values::HasViewportPercentage;
578572
use values::computed::NumberOrPercentage as ComputedNumberOrPercentage;
579573
use values::specified::{NumberOrPercentage, Percentage};
580574

components/style/properties/longhand/box.mako.rs

+3-23
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
%>
3232
use values::computed::ComputedValueAsSpecified;
3333
use style_traits::ToCss;
34-
use values::HasViewportPercentage;
3534
no_viewport_percentage!(SpecifiedValue);
3635

3736
pub mod computed_value {
@@ -170,7 +169,6 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
170169
gecko_inexhaustive="True"
171170
gecko_ffi_name="mFloat"
172171
spec="https://drafts.csswg.org/css-box/#propdef-float">
173-
use values::HasViewportPercentage;
174172
no_viewport_percentage!(SpecifiedValue);
175173
impl ToComputedValue for SpecifiedValue {
176174
type ComputedValue = computed_value::T;
@@ -209,7 +207,6 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
209207
gecko_enum_prefix="StyleClear"
210208
gecko_ffi_name="mBreakType"
211209
spec="https://www.w3.org/TR/CSS2/visuren.html#flow-control">
212-
use values::HasViewportPercentage;
213210
no_viewport_percentage!(SpecifiedValue);
214211
impl ToComputedValue for SpecifiedValue {
215212
type ComputedValue = computed_value::T;
@@ -263,7 +260,6 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
263260
spec="https://www.w3.org/TR/CSS2/visudet.html#propdef-vertical-align">
264261
use std::fmt;
265262
use style_traits::ToCss;
266-
use values::HasViewportPercentage;
267263
use values::specified::AllowQuirks;
268264

269265
<% vertical_align = data.longhands_by_name["vertical-align"] %>
@@ -312,10 +308,9 @@ ${helpers.single_keyword("position", "static absolute relative fixed",
312308

313309
/// The computed value for `vertical-align`.
314310
pub mod computed_value {
315-
use app_units::Au;
316311
use std::fmt;
317312
use style_traits::ToCss;
318-
use values::{CSSFloat, computed};
313+
use values::computed;
319314

320315
/// The keywords are the same, and the `LengthOrPercentage` is computed
321316
/// here.
@@ -417,7 +412,6 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
417412
use values::specified::Time;
418413

419414
pub use values::specified::Time as SpecifiedValue;
420-
use values::HasViewportPercentage;
421415
no_viewport_percentage!(SpecifiedValue);
422416

423417
pub mod computed_value {
@@ -449,7 +443,6 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
449443
use values::specified::Number;
450444
use euclid::point::{Point2D, TypedPoint2D};
451445
use std::fmt;
452-
use std::marker::PhantomData;
453446
use style_traits::ToCss;
454447

455448
// FIXME: This could use static variables and const functions when they are available.
@@ -490,7 +483,6 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
490483

491484
pub mod computed_value {
492485
use euclid::point::Point2D;
493-
use parser::{Parse, ParserContext};
494486
use std::fmt;
495487
use style_traits::ToCss;
496488
use super::FunctionKeyword;
@@ -755,7 +747,6 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
755747
}
756748
}
757749

758-
use values::HasViewportPercentage;
759750
no_viewport_percentage!(SpecifiedValue);
760751

761752
#[inline]
@@ -786,8 +777,6 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
786777
pub use properties::animated_properties::TransitionProperty as SpecifiedValue;
787778

788779
pub mod computed_value {
789-
use std::fmt;
790-
use style_traits::ToCss;
791780
// NB: Can't generate the type here because it needs all the longhands
792781
// generated beforehand.
793782
pub use super::SpecifiedValue as T;
@@ -801,7 +790,6 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
801790
TransitionProperty::All
802791
}
803792

804-
use values::HasViewportPercentage;
805793
no_viewport_percentage!(SpecifiedValue);
806794

807795
impl ComputedValueAsSpecified for SpecifiedValue { }
@@ -830,10 +818,9 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
830818
spec="https://drafts.csswg.org/css-animations/#propdef-animation-name">
831819
use Atom;
832820
use std::fmt;
833-
use std::ops::Deref;
834821
use style_traits::ToCss;
835822
use values::computed::ComputedValueAsSpecified;
836-
use values::{HasViewportPercentage, KeyframesName};
823+
use values::KeyframesName;
837824

838825
pub mod computed_value {
839826
pub use super::SpecifiedValue as T;
@@ -928,7 +915,6 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
928915
use std::fmt;
929916
use style_traits::ToCss;
930917
use values::computed::ComputedValueAsSpecified;
931-
use values::HasViewportPercentage;
932918

933919
pub mod computed_value {
934920
pub use super::SpecifiedValue as T;
@@ -1036,7 +1022,6 @@ ${helpers.single_keyword("animation-fill-mode",
10361022
spec="Nonstandard (https://www.w3.org/TR/2015/WD-css-snappoints-1-20150326/#scroll-snap-points)">
10371023
use std::fmt;
10381024
use style_traits::ToCss;
1039-
use values::HasViewportPercentage;
10401025
use values::specified::LengthOrPercentage;
10411026

10421027
pub mod computed_value {
@@ -1157,9 +1142,8 @@ ${helpers.predefined_type("scroll-snap-coordinate",
11571142
use values::specified::{LengthOrNumber, LengthOrPercentageOrNumber as LoPoNumber, Number};
11581143
use style_traits::ToCss;
11591144
use style_traits::values::Css;
1160-
use values::HasViewportPercentage;
11611145

1162-
use std::fmt::{self, Display};
1146+
use std::fmt;
11631147

11641148
pub mod computed_value {
11651149
use app_units::Au;
@@ -2121,7 +2105,6 @@ ${helpers.single_keyword("transform-style",
21212105
use app_units::Au;
21222106
use std::fmt;
21232107
use style_traits::ToCss;
2124-
use values::HasViewportPercentage;
21252108
use values::specified::{NoCalcLength, LengthOrPercentage, Percentage};
21262109

21272110
pub mod computed_value {
@@ -2239,7 +2222,6 @@ ${helpers.single_keyword("transform-style",
22392222
spec="https://drafts.csswg.org/css-contain/#contain-property">
22402223
use std::fmt;
22412224
use style_traits::ToCss;
2242-
use values::HasViewportPercentage;
22432225
use values::computed::ComputedValueAsSpecified;
22442226

22452227
impl ComputedValueAsSpecified for SpecifiedValue {}
@@ -2392,7 +2374,6 @@ ${helpers.single_keyword("-moz-orient",
23922374
use cssparser::serialize_identifier;
23932375
use std::fmt;
23942376
use style_traits::ToCss;
2395-
use values::HasViewportPercentage;
23962377
use values::computed::ComputedValueAsSpecified;
23972378

23982379
impl ComputedValueAsSpecified for SpecifiedValue {}
@@ -2465,7 +2446,6 @@ ${helpers.predefined_type("shape-outside", "basic_shape::ShapeWithShapeBox",
24652446
use gecko_bindings::structs;
24662447
use std::fmt;
24672448
use style_traits::ToCss;
2468-
use values::HasViewportPercentage;
24692449
use values::computed::ComputedValueAsSpecified;
24702450

24712451
impl ComputedValueAsSpecified for SpecifiedValue {}

components/style/properties/longhand/color.mako.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use cssparser::RGBA;
1515
use std::fmt;
1616
use style_traits::ToCss;
17-
use values::specified::{AllowQuirks, Color, CSSColor, CSSRGBA};
17+
use values::specified::{AllowQuirks, Color, CSSColor};
1818

1919
impl ToComputedValue for SpecifiedValue {
2020
type ComputedValue = computed_value::T;
@@ -122,6 +122,7 @@
122122

123123
impl SystemColor {
124124
pub fn parse(input: &mut Parser) -> Result<Self, ()> {
125+
#[cfg(feature = "gecko")]
125126
use std::ascii::AsciiExt;
126127
static PARSE_ARRAY: &'static [(&'static str, SystemColor); ${len(system_colors)}] = &[
127128
% for color in system_colors:

0 commit comments

Comments
 (0)