Skip to content

Commit a0d9f97

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 a0d9f97

File tree

35 files changed

+75
-116
lines changed

35 files changed

+75
-116
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

-6
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,6 @@ pub struct IOCompositor<Window: WindowMethods + ?Sized> {
141141
/// the compositor.
142142
pub shutdown_state: ShutdownState,
143143

144-
/// Tracks the last composite time.
145-
last_composite_time: u64,
146-
147144
/// Tracks whether the zoom action has happened recently.
148145
zoom_action: bool,
149146

@@ -320,7 +317,6 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
320317
frame_tree_id: FrameTreeId(0),
321318
constellation_chan: state.constellation_chan,
322319
time_profiler_chan: state.time_profiler_chan,
323-
last_composite_time: 0,
324320
ready_to_save_state: ReadyState::Unknown,
325321
webrender: state.webrender,
326322
webrender_document: state.webrender_document,
@@ -1580,8 +1576,6 @@ impl<Window: WindowMethods + ?Sized> IOCompositor<Window> {
15801576
warn!("Failed to present surface: {:?}", err);
15811577
}
15821578

1583-
self.last_composite_time = precise_time_ns();
1584-
15851579
self.composition_request = CompositionRequest::NoCompositingNecessary;
15861580

15871581
self.process_animations();

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

+1-5
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@ use msg::constellation_msg::PipelineId;
1111
use serde_json::{Map, Value};
1212
use std::mem;
1313
use std::net::TcpStream;
14-
use time::precise_time_ns;
1514

1615
pub struct FramerateActor {
1716
name: String,
1817
pipeline: PipelineId,
1918
script_sender: IpcSender<DevtoolScriptControlMsg>,
20-
start_time: Option<u64>,
19+
2120
is_recording: bool,
2221
ticks: Vec<HighResolutionStamp>,
2322
}
@@ -51,7 +50,6 @@ impl FramerateActor {
5150
name: actor_name.clone(),
5251
pipeline: pipeline_id,
5352
script_sender: script_sender,
54-
start_time: None,
5553
is_recording: false,
5654
ticks: Vec::new(),
5755
};
@@ -79,7 +77,6 @@ impl FramerateActor {
7977
return;
8078
}
8179

82-
self.start_time = Some(precise_time_ns());
8380
self.is_recording = true;
8481

8582
let msg = DevtoolScriptControlMsg::RequestAnimationFrame(self.pipeline, self.name());
@@ -91,7 +88,6 @@ impl FramerateActor {
9188
return;
9289
}
9390
self.is_recording = false;
94-
self.start_time = None;
9591
}
9692
}
9793

components/layout/table_wrapper.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ impl TableWrapperFlow {
157157
.zip(guesses.iter())
158158
{
159159
intermediate_column_inline_size.size = guess.calculate(selection);
160-
intermediate_column_inline_size.percentage = 0.0;
160+
// intermediate_column_inline_size.percentage = 0.0;
161161
total_used_inline_size = total_used_inline_size + intermediate_column_inline_size.size
162162
}
163163

@@ -382,7 +382,7 @@ impl Flow for TableWrapperFlow {
382382
.map(
383383
|column_intrinsic_inline_size| IntermediateColumnInlineSize {
384384
size: column_intrinsic_inline_size.minimum_length,
385-
percentage: column_intrinsic_inline_size.percentage,
385+
// percentage: column_intrinsic_inline_size.percentage,
386386
},
387387
)
388388
.collect::<Vec<_>>();
@@ -822,7 +822,9 @@ impl ExcessInlineSizeDistributionInfo {
822822
/// An intermediate column size assignment.
823823
struct IntermediateColumnInlineSize {
824824
size: Au,
825-
percentage: f32,
825+
// This used to be stored here but nothing used it,
826+
// which started emitting a compiler warning: https://github.com/servo/servo/pull/28202
827+
// percentage: f32,
826828
}
827829

828830
/// Returns the computed inline size of the table wrapper represented by `block`.

components/layout_thread/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,6 @@ pub struct LayoutThread {
189189
/// The root of the flow tree.
190190
root_flow: RefCell<Option<FlowRef>>,
191191

192-
/// The document-specific shared lock used for author-origin stylesheets
193-
document_shared_lock: Option<SharedRwLock>,
194-
195192
/// A counter for epoch messages
196193
epoch: Cell<Epoch>,
197194

@@ -543,7 +540,6 @@ impl LayoutThread {
543540
generation: Cell::new(0),
544541
outstanding_web_fonts: Arc::new(AtomicUsize::new(0)),
545542
root_flow: RefCell::new(None),
546-
document_shared_lock: None,
547543
// Epoch starts at 1 because of the initial display list for epoch 0 that we send to WR
548544
epoch: Cell::new(Epoch(1)),
549545
viewport_size: Size2D::new(Au(0), Au(0)),
@@ -1261,7 +1257,6 @@ impl LayoutThread {
12611257
// Calculate the actual viewport as per DEVICE-ADAPT § 6
12621258
// If the entire flow tree is invalid, then it will be reflowed anyhow.
12631259
let document_shared_lock = document.style_shared_lock();
1264-
self.document_shared_lock = Some(document_shared_lock.clone());
12651260
let author_guard = document_shared_lock.read();
12661261

12671262
let ua_stylesheets = &*UA_STYLESHEETS;

components/layout_thread_2020/lib.rs

-5
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,6 @@ pub struct LayoutThread {
167167
/// The fragment tree.
168168
fragment_tree: RefCell<Option<Arc<FragmentTree>>>,
169169

170-
/// The document-specific shared lock used for author-origin stylesheets
171-
document_shared_lock: Option<SharedRwLock>,
172-
173170
/// A counter for epoch messages
174171
epoch: Cell<Epoch>,
175172

@@ -510,7 +507,6 @@ impl LayoutThread {
510507
outstanding_web_fonts: Arc::new(AtomicUsize::new(0)),
511508
box_tree: Default::default(),
512509
fragment_tree: Default::default(),
513-
document_shared_lock: None,
514510
// Epoch starts at 1 because of the initial display list for epoch 0 that we send to WR
515511
epoch: Cell::new(Epoch(1)),
516512
viewport_size: Size2D::new(Au(0), Au(0)),
@@ -947,7 +943,6 @@ impl LayoutThread {
947943
// Calculate the actual viewport as per DEVICE-ADAPT § 6
948944
// If the entire flow tree is invalid, then it will be reflowed anyhow.
949945
let document_shared_lock = document.style_shared_lock();
950-
self.document_shared_lock = Some(document_shared_lock.clone());
951946
let author_guard = document_shared_lock.read();
952947

953948
let ua_stylesheets = &*UA_STYLESHEETS;

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)),

0 commit comments

Comments
 (0)