Fix some new warnings

This commit is contained in:
Simon Sapin 2019-06-19 16:07:13 +02:00
parent 112f1ddeba
commit 1d38bc0419
65 changed files with 179 additions and 175 deletions

View file

@ -140,7 +140,7 @@ pub fn is_token(s: &[u8]) -> bool {
s.iter().all(|&x| {
// http://tools.ietf.org/html/rfc2616#section-2.2
match x {
0...31 | 127 => false, // CTLs
0..=31 | 127 => false, // CTLs
40 | 41 | 60 | 62 | 64 | 44 | 59 | 58 | 92 | 34 | 47 | 91 | 93 | 63 | 61 | 123 |
125 | 32 => false, // separators
x if x > 127 => false, // non-CHARs

View file

@ -96,21 +96,21 @@ pub fn xml_name_type(name: &str) -> XMLName {
fn is_valid_start(c: char) -> bool {
match c {
':' |
'A'...'Z' |
'A'..='Z' |
'_' |
'a'...'z' |
'\u{C0}'...'\u{D6}' |
'\u{D8}'...'\u{F6}' |
'\u{F8}'...'\u{2FF}' |
'\u{370}'...'\u{37D}' |
'\u{37F}'...'\u{1FFF}' |
'\u{200C}'...'\u{200D}' |
'\u{2070}'...'\u{218F}' |
'\u{2C00}'...'\u{2FEF}' |
'\u{3001}'...'\u{D7FF}' |
'\u{F900}'...'\u{FDCF}' |
'\u{FDF0}'...'\u{FFFD}' |
'\u{10000}'...'\u{EFFFF}' => true,
'a'..='z' |
'\u{C0}'..='\u{D6}' |
'\u{D8}'..='\u{F6}' |
'\u{F8}'..='\u{2FF}' |
'\u{370}'..='\u{37D}' |
'\u{37F}'..='\u{1FFF}' |
'\u{200C}'..='\u{200D}' |
'\u{2070}'..='\u{218F}' |
'\u{2C00}'..='\u{2FEF}' |
'\u{3001}'..='\u{D7FF}' |
'\u{F900}'..='\u{FDCF}' |
'\u{FDF0}'..='\u{FFFD}' |
'\u{10000}'..='\u{EFFFF}' => true,
_ => false,
}
}
@ -120,10 +120,10 @@ pub fn xml_name_type(name: &str) -> XMLName {
match c {
'-' |
'.' |
'0'...'9' |
'0'..='9' |
'\u{B7}' |
'\u{300}'...'\u{36F}' |
'\u{203F}'...'\u{2040}' => true,
'\u{300}'..='\u{36F}' |
'\u{203F}'..='\u{2040}' => true,
_ => false,
}
}

View file

@ -174,9 +174,9 @@ pub struct DedicatedWorkerGlobalScope {
worker: DomRefCell<Option<TrustedWorkerAddress>>,
#[ignore_malloc_size_of = "Can't measure trait objects"]
/// Sender to the parent thread.
parent_sender: Box<ScriptChan + Send>,
parent_sender: Box<dyn ScriptChan + Send>,
#[ignore_malloc_size_of = "Arc"]
image_cache: Arc<ImageCache>,
image_cache: Arc<dyn ImageCache>,
}
impl WorkerEventLoopMethods for DedicatedWorkerGlobalScope {

View file

@ -499,7 +499,7 @@ fn is_field_vchar(x: u8) -> bool {
// https://tools.ietf.org/html/rfc5234#appendix-B.1
pub fn is_vchar(x: u8) -> bool {
match x {
0x21...0x7E => true,
0x21..=0x7E => true,
_ => false,
}
}
@ -507,7 +507,7 @@ pub fn is_vchar(x: u8) -> bool {
// http://tools.ietf.org/html/rfc7230#section-3.2.6
pub fn is_obs_text(x: u8) -> bool {
match x {
0x80...0xFF => true,
0x80..=0xFF => true,
_ => false,
}
}

View file

@ -82,7 +82,7 @@ impl Area {
while index < size {
let val = num[index];
match val {
b'0'...b'9' | b'.' | b'-' | b'E' | b'e' => break,
b'0'..=b'9' | b'.' | b'-' | b'E' | b'e' => break,
_ => {},
}

View file

@ -57,7 +57,7 @@ pub struct HTMLCollection {
reflector_: Reflector,
root: Dom<Node>,
#[ignore_malloc_size_of = "Contains a trait object; can't measure due to #6870"]
filter: Box<CollectionFilter + 'static>,
filter: Box<dyn CollectionFilter + 'static>,
// We cache the version of the root node and all its decendents,
// the length of the collection, and a cursor into the collection.
// FIXME: make the cached cursor element a weak pointer

View file

@ -210,7 +210,7 @@ impl FetchResponseListener for ImageContext {
0 => Err(NetworkError::Internal(
"No http status code received".to_owned(),
)),
200...299 => Ok(()), // HTTP ok status codes
200..=299 => Ok(()), // HTTP ok status codes
_ => Err(NetworkError::Internal(format!(
"HTTP error code {}",
status_code

View file

@ -227,7 +227,7 @@ pub struct HTMLMediaElement {
#[ignore_malloc_size_of = "promises are hard"]
in_flight_play_promises_queue: DomRefCell<VecDeque<(Box<[Rc<Promise>]>, ErrorResult)>>,
#[ignore_malloc_size_of = "servo_media"]
player: DomRefCell<Option<Box<Player>>>,
player: DomRefCell<Option<Box<dyn Player>>>,
#[ignore_malloc_size_of = "Arc"]
frame_renderer: Arc<Mutex<MediaFrameRenderer>>,
/// https://html.spec.whatwg.org/multipage/#show-poster-flag
@ -1223,7 +1223,7 @@ impl HTMLMediaElement {
};
let (action_sender, action_receiver) = ipc::channel().unwrap();
let renderer: Option<Arc<Mutex<FrameRenderer>>> = match self.media_type_id() {
let renderer: Option<Arc<Mutex<dyn FrameRenderer>>> = match self.media_type_id() {
HTMLMediaElementTypeId::HTMLAudioElement => None,
HTMLMediaElementTypeId::HTMLVideoElement => Some(self.frame_renderer.clone()),
};

View file

@ -198,7 +198,7 @@ impl FetchResponseListener for ScriptContext {
0 => Err(NetworkError::Internal(
"No http status code received".to_owned(),
)),
200...299 => Ok(()), // HTTP ok status codes
200..=299 => Ok(()), // HTTP ok status codes
_ => Err(NetworkError::Internal(format!(
"HTTP error code {}",
status_code

View file

@ -72,7 +72,7 @@ pub struct PaintWorkletGlobalScope {
worklet_global: WorkletGlobalScope,
/// The image cache
#[ignore_malloc_size_of = "Arc"]
image_cache: Arc<ImageCache>,
image_cache: Arc<dyn ImageCache>,
/// <https://drafts.css-houdini.org/css-paint-api/#paint-definitions>
paint_definitions: DomRefCell<HashMap<Atom, Box<PaintDefinition>>>,
/// <https://drafts.css-houdini.org/css-paint-api/#paint-class-instances>

View file

@ -19,8 +19,8 @@ pub trait Callback: JSTraceable + MallocSizeOf {
#[dom_struct]
pub struct PromiseNativeHandler {
reflector: Reflector,
resolve: Option<Box<Callback>>,
reject: Option<Box<Callback>>,
resolve: Option<Box<dyn Callback>>,
reject: Option<Box<dyn Callback>>,
}
impl PromiseNativeHandler {

View file

@ -203,7 +203,7 @@ impl RTCPeerConnection {
Ok(RTCPeerConnection::new(&window.global(), config))
}
fn make_signaller(&self) -> Box<WebRtcSignaller> {
fn make_signaller(&self) -> Box<dyn WebRtcSignaller> {
let trusted = Trusted::new(self);
let (task_source, canceller) = self
.global()

View file

@ -174,7 +174,7 @@ pub struct Window {
task_manager: TaskManager,
navigator: MutNullableDom<Navigator>,
#[ignore_malloc_size_of = "Arc"]
image_cache: Arc<ImageCache>,
image_cache: Arc<dyn ImageCache>,
#[ignore_malloc_size_of = "channels are hard"]
image_cache_chan: Sender<ImageCacheMsg>,
window_proxy: MutNullableDom<WindowProxy>,
@ -215,7 +215,7 @@ pub struct Window {
/// A handle to perform RPC calls into the layout, quickly.
#[ignore_malloc_size_of = "trait objects are hard"]
layout_rpc: Box<LayoutRPC + Send + 'static>,
layout_rpc: Box<dyn LayoutRPC + Send + 'static>,
/// The current size of the window, in pixels.
window_size: Cell<WindowSizeData>,

View file

@ -1668,7 +1668,7 @@ pub fn is_field_value(slice: &[u8]) -> bool {
false
}
},
0...31 | 127 => false, // CTLs
0..=31 | 127 => false, // CTLs
x if x > 127 => false, // non ASCII
_ if prev == PreviousCharacter::Other || prev == PreviousCharacter::SPHT => {
prev = PreviousCharacter::Other;

View file

@ -4,7 +4,6 @@
#![cfg_attr(feature = "unstable", feature(core_intrinsics))]
#![cfg_attr(feature = "unstable", feature(on_unimplemented))]
#![feature(borrow_state)]
#![feature(const_fn)]
#![feature(drain_filter)]
#![feature(inner_deref)]

View file

@ -508,8 +508,8 @@ unsafe_no_jsmanaged_fields!(RefCell<IncompleteParserContexts>);
unsafe_no_jsmanaged_fields!(TaskQueue<MainThreadScriptMsg>);
unsafe_no_jsmanaged_fields!(BackgroundHangMonitorRegister);
unsafe_no_jsmanaged_fields!(BackgroundHangMonitor);
unsafe_no_jsmanaged_fields!(dyn BackgroundHangMonitorRegister);
unsafe_no_jsmanaged_fields!(dyn BackgroundHangMonitor);
#[derive(JSTraceable)]
// ScriptThread instances are rooted on creation, so this is okay
@ -540,9 +540,9 @@ pub struct ScriptThread {
task_queue: TaskQueue<MainThreadScriptMsg>,
/// A handle to register associated layout threads for hang-monitoring.
background_hang_monitor_register: Box<BackgroundHangMonitorRegister>,
background_hang_monitor_register: Box<dyn BackgroundHangMonitorRegister>,
/// The dedicated means of communication with the background-hang-monitor for this script-thread.
background_hang_monitor: Box<BackgroundHangMonitor>,
background_hang_monitor: Box<dyn BackgroundHangMonitor>,
/// A channel to hand out to script thread-based entities that need to be able to enqueue
/// events in the event queue.
@ -2337,7 +2337,7 @@ impl ScriptThread {
// 2. If response's status is 204 or 205, then abort these steps.
match metadata {
Some(Metadata {
status: Some((204...205, _)),
status: Some((204..=205, _)),
..
}) => {
// If we have an existing window that is being navigated: