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" https://github.com/rust-lang/rust/issues/79202
This commit is contained in:
Simon Sapin 2021-02-25 10:39:53 +01:00
parent 4353d534d4
commit a0d9f97c8e
35 changed files with 75 additions and 116 deletions

View file

@ -174,7 +174,7 @@ pub struct ServoGlue {
// and exit if it is empty afterwards.
browsers: Vec<BrowserId>,
events: Vec<WindowEvent>,
current_url: Option<ServoUrl>,
context_menu_sender: Option<IpcSender<ContextMenuResult>>,
}
@ -306,7 +306,6 @@ pub fn init(
browser_id: None,
browsers: vec![],
events: vec![],
current_url: Some(url.clone()),
context_menu_sender: None,
};
let browser_id = BrowserId::new();
@ -636,7 +635,6 @@ impl ServoGlue {
self.callbacks
.host_callbacks
.on_url_changed(entries[current].clone().to_string());
self.current_url = Some(entries[current].clone());
},
EmbedderMsg::LoadStart => {
self.callbacks.host_callbacks.on_load_started();

View file

@ -188,7 +188,7 @@ where
Some(ref mut s) => (f)(s),
None => Err("Servo not available in this thread"),
}) {
Err(e) => panic!(e),
Err(e) => panic!("{}", e),
Ok(r) => r,
}
}

View file

@ -42,21 +42,13 @@ pub struct Browser<Window: WindowPortsMethods + ?Sized> {
browsers: Vec<BrowserId>,
title: Option<String>,
status: Option<String>,
favicon: Option<ServoUrl>,
loading_state: Option<LoadingState>,
window: Rc<Window>,
event_queue: Vec<WindowEvent>,
clipboard_ctx: Option<ClipboardContext>,
shutdown_requested: bool,
}
enum LoadingState {
Connecting,
Loading,
Loaded,
}
impl<Window> Browser<Window>
where
Window: WindowPortsMethods + ?Sized,
@ -67,9 +59,6 @@ where
current_url: None,
browser_id: None,
browsers: Vec::new(),
status: None,
favicon: None,
loading_state: None,
window: window,
clipboard_ctx: match ClipboardContext::new() {
Ok(c) => Some(c),
@ -278,8 +267,8 @@ where
pub fn handle_servo_events(&mut self, events: Vec<(Option<BrowserId>, EmbedderMsg)>) {
for (browser_id, msg) in events {
match msg {
EmbedderMsg::Status(status) => {
self.status = status;
EmbedderMsg::Status(_status) => {
// FIXME: surface this status string in the UI somehow
},
EmbedderMsg::ChangePageTitle(title) => {
self.title = title;
@ -440,11 +429,11 @@ where
EmbedderMsg::SetCursor(cursor) => {
self.window.set_cursor(cursor);
},
EmbedderMsg::NewFavicon(url) => {
self.favicon = Some(url);
EmbedderMsg::NewFavicon(_url) => {
// FIXME: show favicons in the UI somehow
},
EmbedderMsg::HeadParsed => {
self.loading_state = Some(LoadingState::Loading);
// FIXME: surface the loading state in the UI somehow
},
EmbedderMsg::HistoryChanged(urls, current) => {
self.current_url = Some(urls[current].clone());
@ -453,10 +442,10 @@ where
self.window.set_fullscreen(state);
},
EmbedderMsg::LoadStart => {
self.loading_state = Some(LoadingState::Connecting);
// FIXME: surface the loading state in the UI somehow
},
EmbedderMsg::LoadComplete => {
self.loading_state = Some(LoadingState::Loaded);
// FIXME: surface the loading state in the UI somehow
},
EmbedderMsg::CloseBrowser => {
// TODO: close the appropriate "tab".