Skip to content

Commit 04b037d

Browse files
committed
Fix warnings introduced in newer Rust Nightly
This does not (yet) upgrade ./rust-toolchain The warnings: * dead_code "field is never read" * redundant_semicolons "unnecessary trailing semicolon" * non_fmt_panic "panic message is not a string literal, this is no longer accepted in Rust 2021" * unstable_name_collisions "a method with this name may be added to the standard library in the future" * legacy_derive_helpers "derive helper attribute is used before it is introduced" rust-lang/rust#79202
1 parent 4353d53 commit 04b037d

File tree

34 files changed

+80
-61
lines changed

34 files changed

+80
-61
lines changed

components/compositing/build.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ fn main() {
4747
_ => panic!("Cannot find package definitions in lockfile"),
4848
}
4949
},
50-
Err(e) => panic!(e),
50+
Err(e) => panic!("{}", e),
5151
}
5252
}

components/compositing/compositor.rs

+1
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ pub struct IOCompositor<Window: WindowMethods + ?Sized> {
142142
pub shutdown_state: ShutdownState,
143143

144144
/// Tracks the last composite time.
145+
#[allow(dead_code)] // FIXME: do something with this or remove it
145146
last_composite_time: u64,
146147

147148
/// Tracks whether the zoom action has happened recently.

components/config/pref_util.rs

+1-6
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,7 @@ macro_rules! impl_from_pref {
113113
if let $variant(value) = other {
114114
value.into()
115115
} else {
116-
panic!(
117-
format!("Cannot convert {:?} to {:?}",
118-
other,
119-
std::any::type_name::<$t>()
120-
)
121-
);
116+
panic!("Cannot convert {:?} to {:?}", other, std::any::type_name::<$t>())
122117
}
123118
}
124119
}

components/config_plugins/lib.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,14 @@ impl Build {
132132
.get_field_name_mapping()
133133
.map(|pref_attr| pref_attr.value())
134134
.unwrap_or_else(|| {
135-
path_stack
136-
.iter()
137-
.chain(iter::once(&field.name))
138-
.map(Ident::to_string)
139-
.intersperse(String::from("."))
140-
.collect()
135+
Itertools::intersperse(
136+
path_stack
137+
.iter()
138+
.chain(iter::once(&field.name))
139+
.map(Ident::to_string),
140+
String::from("."),
141+
)
142+
.collect()
141143
})
142144
}
143145

components/devtools/actors/framerate.rs

+3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ pub struct FramerateActor {
1717
name: String,
1818
pipeline: PipelineId,
1919
script_sender: IpcSender<DevtoolScriptControlMsg>,
20+
21+
#[allow(dead_code)] // FIXME: do something with this or remove it
2022
start_time: Option<u64>,
23+
2124
is_recording: bool,
2225
ticks: Vec<HighResolutionStamp>,
2326
}

components/layout/table_wrapper.rs

+2
Original file line numberDiff line numberDiff line change
@@ -822,6 +822,8 @@ impl ExcessInlineSizeDistributionInfo {
822822
/// An intermediate column size assignment.
823823
struct IntermediateColumnInlineSize {
824824
size: Au,
825+
826+
#[allow(dead_code)] // FIXME: do something with this or remove it
825827
percentage: f32,
826828
}
827829

components/layout_thread/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ pub struct LayoutThread {
190190
root_flow: RefCell<Option<FlowRef>>,
191191

192192
/// The document-specific shared lock used for author-origin stylesheets
193+
#[allow(dead_code)] // FIXME: do something with this or remove it
193194
document_shared_lock: Option<SharedRwLock>,
194195

195196
/// A counter for epoch messages

components/layout_thread_2020/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ pub struct LayoutThread {
168168
fragment_tree: RefCell<Option<Arc<FragmentTree>>>,
169169

170170
/// The document-specific shared lock used for author-origin stylesheets
171+
#[allow(dead_code)] // FIXME: do something with this or remove it
171172
document_shared_lock: Option<SharedRwLock>,
172173

173174
/// A counter for epoch messages

components/net/tests/data_loader.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ fn assert_parse(
4444
filtered: FilteredMetadata::Basic(m),
4545
..
4646
}) => m,
47-
result => panic!(result),
47+
result => panic!("{:?}", result),
4848
};
4949
assert_eq!(metadata.content_type.map(Serde::into_inner), content_type);
5050
assert_eq!(metadata.charset.as_ref().map(String::deref), charset);

components/net_traits/response.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ impl Response {
312312
metadata.referrer_policy = response.referrer_policy.clone();
313313
metadata.redirected = response.actual_response().url_list.len() > 1;
314314
metadata
315-
};
315+
}
316316

317317
if let Some(error) = self.get_network_error() {
318318
return Err(error.clone());

components/profile/mem.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -101,18 +101,15 @@ impl Profiler {
101101
let name_clone = name.clone();
102102
match self.reporters.insert(name, reporter) {
103103
None => true,
104-
Some(_) => panic!(format!(
105-
"RegisterReporter: '{}' name is already in use",
106-
name_clone
107-
)),
104+
Some(_) => panic!("RegisterReporter: '{}' name is already in use", name_clone),
108105
}
109106
},
110107

111108
ProfilerMsg::UnregisterReporter(name) => {
112109
// Panic if it hasn't previously been registered.
113110
match self.reporters.remove(&name) {
114111
Some(_) => true,
115-
None => panic!(format!("UnregisterReporter: '{}' name is unknown", &name)),
112+
None => panic!("UnregisterReporter: '{}' name is unknown", &name),
116113
}
117114
},
118115

components/style/gecko/url.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use style_traits::{CssWriter, ParseError, ToCss};
2121
use to_shmem::{self, SharedMemoryBuilder, ToShmem};
2222

2323
/// A CSS url() value for gecko.
24-
#[css(function = "url")]
2524
#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
25+
#[css(function = "url")]
2626
#[repr(C)]
2727
pub struct CssUrl(pub Arc<CssUrlData>);
2828

components/style/media_queries/media_list.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use cssparser::{Delimiter, Parser};
1414
use cssparser::{ParserInput, Token};
1515

1616
/// A type that encapsulates a media query list.
17-
#[css(comma, derive_debug)]
1817
#[derive(Clone, MallocSizeOf, ToCss, ToShmem)]
18+
#[css(comma, derive_debug)]
1919
pub struct MediaList {
2020
/// The list of media queries.
2121
#[css(iterable)]

components/style/properties/helpers.mako.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,6 @@
170170
/// Making this type generic allows the compiler to figure out the
171171
/// animated value for us, instead of having to implement it
172172
/// manually for every type we care about.
173-
% if separator == "Comma":
174-
#[css(comma)]
175-
% endif
176173
#[derive(
177174
Clone,
178175
Debug,
@@ -182,6 +179,9 @@
182179
ToResolvedValue,
183180
ToCss,
184181
)]
182+
% if separator == "Comma":
183+
#[css(comma)]
184+
% endif
185185
pub struct OwnedList<T>(
186186
% if not allow_empty:
187187
#[css(iterable)]
@@ -198,16 +198,16 @@
198198
% else:
199199
pub use self::ComputedList as List;
200200

201-
% if separator == "Comma":
202-
#[css(comma)]
203-
% endif
204201
#[derive(
205202
Clone,
206203
Debug,
207204
MallocSizeOf,
208205
PartialEq,
209206
ToCss,
210207
)]
208+
% if separator == "Comma":
209+
#[css(comma)]
210+
% endif
211211
pub struct ComputedList(
212212
% if not allow_empty:
213213
#[css(iterable)]
@@ -324,10 +324,10 @@
324324
}
325325

326326
/// The specified value of ${name}.
327+
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
327328
% if separator == "Comma":
328329
#[css(comma)]
329330
% endif
330-
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
331331
pub struct SpecifiedValue(
332332
% if not allow_empty:
333333
#[css(iterable)]

components/style/stylesheets/document_rule.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ impl DocumentMatchingFunction {
215215
/// The `@document` rule's condition is written as a comma-separated list of
216216
/// URL matching functions, and the condition evaluates to true whenever any
217217
/// one of those functions evaluates to true.
218-
#[css(comma)]
219218
#[derive(Clone, Debug, ToCss, ToShmem)]
219+
#[css(comma)]
220220
pub struct DocumentCondition(#[css(iterable)] Vec<DocumentMatchingFunction>);
221221

222222
impl DocumentCondition {

components/style/stylesheets/keyframes_rule.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ impl KeyframePercentage {
149149

150150
/// A keyframes selector is a list of percentages or from/to symbols, which are
151151
/// converted at parse time to percentages.
152-
#[css(comma)]
153152
#[derive(Clone, Debug, Eq, PartialEq, ToCss, ToShmem)]
153+
#[css(comma)]
154154
pub struct KeyframeSelector(#[css(iterable)] Vec<KeyframePercentage>);
155155

156156
impl KeyframeSelector {

components/style/values/animated/font.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<'a> FontSettingTagIter<'a> {
116116
let mut sorted_tags = Vec::from_iter(tags.iter());
117117
sorted_tags.sort_by_key(|k| k.tag.0);
118118
sorted_tags
119-
};
119+
}
120120

121121
Ok(FontSettingTagIter {
122122
a_state: FontSettingTagIterState::new(as_new_sorted_tags(&a_settings.0)),

components/style/values/generics/basic_shape.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ impl Default for ShapeBox {
9191

9292
/// A value for the `clip-path` property.
9393
#[allow(missing_docs)]
94-
#[animation(no_bound(U))]
9594
#[derive(
9695
Animate,
9796
Clone,
@@ -106,6 +105,7 @@ impl Default for ShapeBox {
106105
ToResolvedValue,
107106
ToShmem,
108107
)]
108+
#[animation(no_bound(U))]
109109
#[repr(u8)]
110110
pub enum GenericClipPath<BasicShape, U> {
111111
#[animation(error)]
@@ -126,7 +126,6 @@ pub use self::GenericClipPath as ClipPath;
126126

127127
/// A value for the `shape-outside` property.
128128
#[allow(missing_docs)]
129-
#[animation(no_bound(I))]
130129
#[derive(
131130
Animate,
132131
Clone,
@@ -141,6 +140,7 @@ pub use self::GenericClipPath as ClipPath;
141140
ToResolvedValue,
142141
ToShmem,
143142
)]
143+
#[animation(no_bound(I))]
144144
#[repr(u8)]
145145
pub enum GenericShapeOutside<BasicShape, I> {
146146
#[animation(error)]
@@ -193,7 +193,6 @@ pub use self::GenericBasicShape as BasicShape;
193193

194194
/// <https://drafts.csswg.org/css-shapes/#funcdef-inset>
195195
#[allow(missing_docs)]
196-
#[css(function = "inset")]
197196
#[derive(
198197
Animate,
199198
Clone,
@@ -207,6 +206,7 @@ pub use self::GenericBasicShape as BasicShape;
207206
ToResolvedValue,
208207
ToShmem,
209208
)]
209+
#[css(function = "inset")]
210210
#[repr(C)]
211211
pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
212212
pub rect: Rect<LengthPercentage>,
@@ -216,7 +216,6 @@ pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
216216

217217
/// <https://drafts.csswg.org/css-shapes/#funcdef-circle>
218218
#[allow(missing_docs)]
219-
#[css(function)]
220219
#[derive(
221220
Animate,
222221
Clone,
@@ -231,6 +230,7 @@ pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
231230
ToResolvedValue,
232231
ToShmem,
233232
)]
233+
#[css(function)]
234234
#[repr(C)]
235235
pub struct Circle<H, V, NonNegativeLengthPercentage> {
236236
pub position: GenericPosition<H, V>,
@@ -239,7 +239,6 @@ pub struct Circle<H, V, NonNegativeLengthPercentage> {
239239

240240
/// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse>
241241
#[allow(missing_docs)]
242-
#[css(function)]
243242
#[derive(
244243
Animate,
245244
Clone,
@@ -254,6 +253,7 @@ pub struct Circle<H, V, NonNegativeLengthPercentage> {
254253
ToResolvedValue,
255254
ToShmem,
256255
)]
256+
#[css(function)]
257257
#[repr(C)]
258258
pub struct Ellipse<H, V, NonNegativeLengthPercentage> {
259259
pub position: GenericPosition<H, V>,
@@ -293,7 +293,6 @@ pub use self::GenericShapeRadius as ShapeRadius;
293293
/// A generic type for representing the `polygon()` function
294294
///
295295
/// <https://drafts.csswg.org/css-shapes/#funcdef-polygon>
296-
#[css(comma, function = "polygon")]
297296
#[derive(
298297
Clone,
299298
Debug,
@@ -306,6 +305,7 @@ pub use self::GenericShapeRadius as ShapeRadius;
306305
ToResolvedValue,
307306
ToShmem,
308307
)]
308+
#[css(comma, function = "polygon")]
309309
#[repr(C)]
310310
pub struct GenericPolygon<LengthPercentage> {
311311
/// The filling rule for a polygon.
@@ -364,7 +364,6 @@ pub enum FillRule {
364364
/// The path function defined in css-shape-2.
365365
///
366366
/// https://drafts.csswg.org/css-shapes-2/#funcdef-path
367-
#[css(comma)]
368367
#[derive(
369368
Animate,
370369
Clone,
@@ -379,6 +378,7 @@ pub enum FillRule {
379378
ToResolvedValue,
380379
ToShmem,
381380
)]
381+
#[css(comma)]
382382
#[repr(C)]
383383
pub struct Path {
384384
/// The filling rule for the svg path.

components/style/values/generics/effects.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ pub use self::GenericBoxShadow as BoxShadow;
3535

3636
/// A generic value for a single `filter`.
3737
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
38-
#[animation(no_bound(U))]
3938
#[derive(
4039
Clone,
4140
ComputeSquaredDistance,
@@ -49,6 +48,7 @@ pub use self::GenericBoxShadow as BoxShadow;
4948
ToResolvedValue,
5049
ToShmem,
5150
)]
51+
#[animation(no_bound(U))]
5252
#[repr(C, u8)]
5353
pub enum GenericFilter<Angle, NonNegativeFactor, ZeroToOneFactor, Length, Shadow, U> {
5454
/// `blur(<length>)`

components/style/values/generics/font.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ pub struct VariationValue<Number> {
7777
}
7878

7979
/// A value both for font-variation-settings and font-feature-settings.
80-
#[css(comma)]
8180
#[derive(
8281
Clone,
8382
Debug,
@@ -90,6 +89,7 @@ pub struct VariationValue<Number> {
9089
ToResolvedValue,
9190
ToShmem,
9291
)]
92+
#[css(comma)]
9393
pub struct FontSettings<T>(#[css(if_empty = "normal", iterable)] pub Box<[T]>);
9494

9595
impl<T> FontSettings<T> {

components/style/values/generics/image.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ impl ToCss for PaintWorklet {
264264
///
265265
/// `-moz-image-rect(<uri>, top, right, bottom, left);`
266266
#[allow(missing_docs)]
267-
#[css(comma, function = "-moz-image-rect")]
268267
#[derive(
269268
Clone,
270269
Debug,
@@ -276,6 +275,7 @@ impl ToCss for PaintWorklet {
276275
ToResolvedValue,
277276
ToShmem,
278277
)]
278+
#[css(comma, function = "-moz-image-rect")]
279279
#[repr(C)]
280280
pub struct GenericMozImageRect<NumberOrPercentage, MozImageRectUrl> {
281281
pub url: MozImageRectUrl,

0 commit comments

Comments
 (0)