Skip to content

Commit

Permalink
Fix warnings introduced in newer Rust Nightly
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SimonSapin committed Feb 25, 2021
1 parent 4353d53 commit 04b037d
Show file tree
Hide file tree
Showing 34 changed files with 80 additions and 61 deletions.
2 changes: 1 addition & 1 deletion components/compositing/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ fn main() {
_ => panic!("Cannot find package definitions in lockfile"),
}
},
Err(e) => panic!(e),
Err(e) => panic!("{}", e),
}
}
1 change: 1 addition & 0 deletions components/compositing/compositor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ pub struct IOCompositor<Window: WindowMethods + ?Sized> {
pub shutdown_state: ShutdownState,

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

/// Tracks whether the zoom action has happened recently.
Expand Down
7 changes: 1 addition & 6 deletions components/config/pref_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,7 @@ macro_rules! impl_from_pref {
if let $variant(value) = other {
value.into()
} else {
panic!(
format!("Cannot convert {:?} to {:?}",
other,
std::any::type_name::<$t>()
)
);
panic!("Cannot convert {:?} to {:?}", other, std::any::type_name::<$t>())
}
}
}
Expand Down
14 changes: 8 additions & 6 deletions components/config_plugins/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,14 @@ impl Build {
.get_field_name_mapping()
.map(|pref_attr| pref_attr.value())
.unwrap_or_else(|| {
path_stack
.iter()
.chain(iter::once(&field.name))
.map(Ident::to_string)
.intersperse(String::from("."))
.collect()
Itertools::intersperse(
path_stack
.iter()
.chain(iter::once(&field.name))
.map(Ident::to_string),
String::from("."),
)
.collect()
})
}

Expand Down
3 changes: 3 additions & 0 deletions components/devtools/actors/framerate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ pub struct FramerateActor {
name: String,
pipeline: PipelineId,
script_sender: IpcSender<DevtoolScriptControlMsg>,

#[allow(dead_code)] // FIXME: do something with this or remove it
start_time: Option<u64>,

is_recording: bool,
ticks: Vec<HighResolutionStamp>,
}
Expand Down
2 changes: 2 additions & 0 deletions components/layout/table_wrapper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,8 @@ impl ExcessInlineSizeDistributionInfo {
/// An intermediate column size assignment.
struct IntermediateColumnInlineSize {
size: Au,

#[allow(dead_code)] // FIXME: do something with this or remove it
percentage: f32,
}

Expand Down
1 change: 1 addition & 0 deletions components/layout_thread/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ pub struct LayoutThread {
root_flow: RefCell<Option<FlowRef>>,

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

/// A counter for epoch messages
Expand Down
1 change: 1 addition & 0 deletions components/layout_thread_2020/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ pub struct LayoutThread {
fragment_tree: RefCell<Option<Arc<FragmentTree>>>,

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

/// A counter for epoch messages
Expand Down
2 changes: 1 addition & 1 deletion components/net/tests/data_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn assert_parse(
filtered: FilteredMetadata::Basic(m),
..
}) => m,
result => panic!(result),
result => panic!("{:?}", result),
};
assert_eq!(metadata.content_type.map(Serde::into_inner), content_type);
assert_eq!(metadata.charset.as_ref().map(String::deref), charset);
Expand Down
2 changes: 1 addition & 1 deletion components/net_traits/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ impl Response {
metadata.referrer_policy = response.referrer_policy.clone();
metadata.redirected = response.actual_response().url_list.len() > 1;
metadata
};
}

if let Some(error) = self.get_network_error() {
return Err(error.clone());
Expand Down
7 changes: 2 additions & 5 deletions components/profile/mem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,15 @@ impl Profiler {
let name_clone = name.clone();
match self.reporters.insert(name, reporter) {
None => true,
Some(_) => panic!(format!(
"RegisterReporter: '{}' name is already in use",
name_clone
)),
Some(_) => panic!("RegisterReporter: '{}' name is already in use", name_clone),
}
},

ProfilerMsg::UnregisterReporter(name) => {
// Panic if it hasn't previously been registered.
match self.reporters.remove(&name) {
Some(_) => true,
None => panic!(format!("UnregisterReporter: '{}' name is unknown", &name)),
None => panic!("UnregisterReporter: '{}' name is unknown", &name),
}
},

Expand Down
2 changes: 1 addition & 1 deletion components/style/gecko/url.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use style_traits::{CssWriter, ParseError, ToCss};
use to_shmem::{self, SharedMemoryBuilder, ToShmem};

/// A CSS url() value for gecko.
#[css(function = "url")]
#[derive(Clone, Debug, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
#[css(function = "url")]
#[repr(C)]
pub struct CssUrl(pub Arc<CssUrlData>);

Expand Down
2 changes: 1 addition & 1 deletion components/style/media_queries/media_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ use cssparser::{Delimiter, Parser};
use cssparser::{ParserInput, Token};

/// A type that encapsulates a media query list.
#[css(comma, derive_debug)]
#[derive(Clone, MallocSizeOf, ToCss, ToShmem)]
#[css(comma, derive_debug)]
pub struct MediaList {
/// The list of media queries.
#[css(iterable)]
Expand Down
14 changes: 7 additions & 7 deletions components/style/properties/helpers.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,6 @@
/// Making this type generic allows the compiler to figure out the
/// animated value for us, instead of having to implement it
/// manually for every type we care about.
% if separator == "Comma":
#[css(comma)]
% endif
#[derive(
Clone,
Debug,
Expand All @@ -182,6 +179,9 @@
ToResolvedValue,
ToCss,
)]
% if separator == "Comma":
#[css(comma)]
% endif
pub struct OwnedList<T>(
% if not allow_empty:
#[css(iterable)]
Expand All @@ -198,16 +198,16 @@
% else:
pub use self::ComputedList as List;

% if separator == "Comma":
#[css(comma)]
% endif
#[derive(
Clone,
Debug,
MallocSizeOf,
PartialEq,
ToCss,
)]
% if separator == "Comma":
#[css(comma)]
% endif
pub struct ComputedList(
% if not allow_empty:
#[css(iterable)]
Expand Down Expand Up @@ -324,10 +324,10 @@
}

/// The specified value of ${name}.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
% if separator == "Comma":
#[css(comma)]
% endif
#[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss, ToShmem)]
pub struct SpecifiedValue(
% if not allow_empty:
#[css(iterable)]
Expand Down
2 changes: 1 addition & 1 deletion components/style/stylesheets/document_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,8 @@ impl DocumentMatchingFunction {
/// The `@document` rule's condition is written as a comma-separated list of
/// URL matching functions, and the condition evaluates to true whenever any
/// one of those functions evaluates to true.
#[css(comma)]
#[derive(Clone, Debug, ToCss, ToShmem)]
#[css(comma)]
pub struct DocumentCondition(#[css(iterable)] Vec<DocumentMatchingFunction>);

impl DocumentCondition {
Expand Down
2 changes: 1 addition & 1 deletion components/style/stylesheets/keyframes_rule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,8 @@ impl KeyframePercentage {

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

impl KeyframeSelector {
Expand Down
2 changes: 1 addition & 1 deletion components/style/values/animated/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl<'a> FontSettingTagIter<'a> {
let mut sorted_tags = Vec::from_iter(tags.iter());
sorted_tags.sort_by_key(|k| k.tag.0);
sorted_tags
};
}

Ok(FontSettingTagIter {
a_state: FontSettingTagIterState::new(as_new_sorted_tags(&a_settings.0)),
Expand Down
14 changes: 7 additions & 7 deletions components/style/values/generics/basic_shape.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ impl Default for ShapeBox {

/// A value for the `clip-path` property.
#[allow(missing_docs)]
#[animation(no_bound(U))]
#[derive(
Animate,
Clone,
Expand All @@ -106,6 +105,7 @@ impl Default for ShapeBox {
ToResolvedValue,
ToShmem,
)]
#[animation(no_bound(U))]
#[repr(u8)]
pub enum GenericClipPath<BasicShape, U> {
#[animation(error)]
Expand All @@ -126,7 +126,6 @@ pub use self::GenericClipPath as ClipPath;

/// A value for the `shape-outside` property.
#[allow(missing_docs)]
#[animation(no_bound(I))]
#[derive(
Animate,
Clone,
Expand All @@ -141,6 +140,7 @@ pub use self::GenericClipPath as ClipPath;
ToResolvedValue,
ToShmem,
)]
#[animation(no_bound(I))]
#[repr(u8)]
pub enum GenericShapeOutside<BasicShape, I> {
#[animation(error)]
Expand Down Expand Up @@ -193,7 +193,6 @@ pub use self::GenericBasicShape as BasicShape;

/// <https://drafts.csswg.org/css-shapes/#funcdef-inset>
#[allow(missing_docs)]
#[css(function = "inset")]
#[derive(
Animate,
Clone,
Expand All @@ -207,6 +206,7 @@ pub use self::GenericBasicShape as BasicShape;
ToResolvedValue,
ToShmem,
)]
#[css(function = "inset")]
#[repr(C)]
pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
pub rect: Rect<LengthPercentage>,
Expand All @@ -216,7 +216,6 @@ pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {

/// <https://drafts.csswg.org/css-shapes/#funcdef-circle>
#[allow(missing_docs)]
#[css(function)]
#[derive(
Animate,
Clone,
Expand All @@ -231,6 +230,7 @@ pub struct InsetRect<LengthPercentage, NonNegativeLengthPercentage> {
ToResolvedValue,
ToShmem,
)]
#[css(function)]
#[repr(C)]
pub struct Circle<H, V, NonNegativeLengthPercentage> {
pub position: GenericPosition<H, V>,
Expand All @@ -239,7 +239,6 @@ pub struct Circle<H, V, NonNegativeLengthPercentage> {

/// <https://drafts.csswg.org/css-shapes/#funcdef-ellipse>
#[allow(missing_docs)]
#[css(function)]
#[derive(
Animate,
Clone,
Expand All @@ -254,6 +253,7 @@ pub struct Circle<H, V, NonNegativeLengthPercentage> {
ToResolvedValue,
ToShmem,
)]
#[css(function)]
#[repr(C)]
pub struct Ellipse<H, V, NonNegativeLengthPercentage> {
pub position: GenericPosition<H, V>,
Expand Down Expand Up @@ -293,7 +293,6 @@ pub use self::GenericShapeRadius as ShapeRadius;
/// A generic type for representing the `polygon()` function
///
/// <https://drafts.csswg.org/css-shapes/#funcdef-polygon>
#[css(comma, function = "polygon")]
#[derive(
Clone,
Debug,
Expand All @@ -306,6 +305,7 @@ pub use self::GenericShapeRadius as ShapeRadius;
ToResolvedValue,
ToShmem,
)]
#[css(comma, function = "polygon")]
#[repr(C)]
pub struct GenericPolygon<LengthPercentage> {
/// The filling rule for a polygon.
Expand Down Expand Up @@ -364,7 +364,6 @@ pub enum FillRule {
/// The path function defined in css-shape-2.
///
/// https://drafts.csswg.org/css-shapes-2/#funcdef-path
#[css(comma)]
#[derive(
Animate,
Clone,
Expand All @@ -379,6 +378,7 @@ pub enum FillRule {
ToResolvedValue,
ToShmem,
)]
#[css(comma)]
#[repr(C)]
pub struct Path {
/// The filling rule for the svg path.
Expand Down
2 changes: 1 addition & 1 deletion components/style/values/generics/effects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ pub use self::GenericBoxShadow as BoxShadow;

/// A generic value for a single `filter`.
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[animation(no_bound(U))]
#[derive(
Clone,
ComputeSquaredDistance,
Expand All @@ -49,6 +48,7 @@ pub use self::GenericBoxShadow as BoxShadow;
ToResolvedValue,
ToShmem,
)]
#[animation(no_bound(U))]
#[repr(C, u8)]
pub enum GenericFilter<Angle, NonNegativeFactor, ZeroToOneFactor, Length, Shadow, U> {
/// `blur(<length>)`
Expand Down
2 changes: 1 addition & 1 deletion components/style/values/generics/font.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ pub struct VariationValue<Number> {
}

/// A value both for font-variation-settings and font-feature-settings.
#[css(comma)]
#[derive(
Clone,
Debug,
Expand All @@ -90,6 +89,7 @@ pub struct VariationValue<Number> {
ToResolvedValue,
ToShmem,
)]
#[css(comma)]
pub struct FontSettings<T>(#[css(if_empty = "normal", iterable)] pub Box<[T]>);

impl<T> FontSettings<T> {
Expand Down
2 changes: 1 addition & 1 deletion components/style/values/generics/image.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ impl ToCss for PaintWorklet {
///
/// `-moz-image-rect(<uri>, top, right, bottom, left);`
#[allow(missing_docs)]
#[css(comma, function = "-moz-image-rect")]
#[derive(
Clone,
Debug,
Expand All @@ -276,6 +275,7 @@ impl ToCss for PaintWorklet {
ToResolvedValue,
ToShmem,
)]
#[css(comma, function = "-moz-image-rect")]
#[repr(C)]
pub struct GenericMozImageRect<NumberOrPercentage, MozImageRectUrl> {
pub url: MozImageRectUrl,
Expand Down
Loading

0 comments on commit 04b037d

Please sign in to comment.