Bug 1508670 - [webdriver] Fix Rust code to be compatible with Rust 2018 edition. r=ato

Depends on D13398

Differential Revision: https://phabricator.services.mozilla.com/D13399

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Henrik Skupin 2018-11-30 06:05:15 +00:00
parent 5c33925458
commit ffd608a8a0
8 changed files with 42 additions and 39 deletions

View File

@ -1,4 +1,4 @@
use common::{WebElement, ELEMENT_KEY};
use crate::common::{WebElement, ELEMENT_KEY};
use serde::de::{self, Deserialize, Deserializer};
use serde::ser::{Serialize, Serializer};
use serde_json::Value;
@ -239,9 +239,9 @@ where
#[cfg(test)]
mod test {
use crate::test::{check_deserialize, check_serialize_deserialize};
use super::*;
use serde_json;
use test::{check_deserialize, check_serialize_deserialize};
#[test]
fn test_json_action_sequence_null() {

View File

@ -1,5 +1,5 @@
use common::MAX_SAFE_INTEGER;
use error::{ErrorStatus, WebDriverError, WebDriverResult};
use crate::common::MAX_SAFE_INTEGER;
use crate::error::{ErrorStatus, WebDriverError, WebDriverResult};
use serde_json::{Map, Value};
use url::Url;
@ -17,13 +17,13 @@ pub trait BrowserCapabilities {
/// Set up the Capabilites object
///
/// Typically used to create any internal caches
fn init(&mut self, &Capabilities);
fn init(&mut self, _: &Capabilities);
/// Name of the browser
fn browser_name(&mut self, &Capabilities) -> WebDriverResult<Option<String>>;
fn browser_name(&mut self, _: &Capabilities) -> WebDriverResult<Option<String>>;
/// Version number of the browser
fn browser_version(&mut self, &Capabilities) -> WebDriverResult<Option<String>>;
fn browser_version(&mut self, _: &Capabilities) -> WebDriverResult<Option<String>>;
/// Compare actual browser version to that provided in a version specifier
///
@ -34,22 +34,22 @@ pub trait BrowserCapabilities {
-> WebDriverResult<bool>;
/// Name of the platform/OS
fn platform_name(&mut self, &Capabilities) -> WebDriverResult<Option<String>>;
fn platform_name(&mut self, _: &Capabilities) -> WebDriverResult<Option<String>>;
/// Whether insecure certificates are supported
fn accept_insecure_certs(&mut self, &Capabilities) -> WebDriverResult<bool>;
fn accept_insecure_certs(&mut self, _: &Capabilities) -> WebDriverResult<bool>;
/// Indicates whether driver supports all of the window resizing and
/// repositioning commands.
fn set_window_rect(&mut self, &Capabilities) -> WebDriverResult<bool>;
fn set_window_rect(&mut self, _: &Capabilities) -> WebDriverResult<bool>;
/// Indicates that interactability checks will be applied to `<input type=file>`.
fn strict_file_interactability(&mut self, &Capabilities) -> WebDriverResult<bool>;
fn strict_file_interactability(&mut self, _: &Capabilities) -> WebDriverResult<bool>;
fn accept_proxy(
&mut self,
proxy_settings: &Map<String, Value>,
&Capabilities,
_: &Capabilities,
) -> WebDriverResult<bool>;
/// Type check custom properties
@ -561,8 +561,8 @@ impl CapabilitiesMatching for LegacyNewSessionParameters {
#[cfg(test)]
mod tests {
use super::*;
use crate::test::check_deserialize;
use serde_json::{self, Value};
use test::check_deserialize;
fn validate_proxy(value: &str) -> WebDriverResult<()> {
let data = serde_json::from_str::<Value>(value).unwrap();

View File

@ -1,9 +1,11 @@
use actions::ActionSequence;
use capabilities::{BrowserCapabilities, Capabilities, CapabilitiesMatching,
LegacyNewSessionParameters, SpecNewSessionParameters};
use common::{Date, FrameId, LocatorStrategy, WebElement, MAX_SAFE_INTEGER};
use error::{ErrorStatus, WebDriverError, WebDriverResult};
use httpapi::{Route, VoidWebDriverExtensionRoute, WebDriverExtensionRoute};
use crate::actions::ActionSequence;
use crate::capabilities::{
BrowserCapabilities, Capabilities, CapabilitiesMatching, LegacyNewSessionParameters,
SpecNewSessionParameters,
};
use crate::common::{Date, FrameId, LocatorStrategy, WebElement, MAX_SAFE_INTEGER};
use crate::error::{ErrorStatus, WebDriverError, WebDriverResult};
use crate::httpapi::{Route, VoidWebDriverExtensionRoute, WebDriverExtensionRoute};
use regex::Captures;
use serde::de::{self, Deserialize, Deserializer};
use serde_json::{self, Value};
@ -611,9 +613,9 @@ where
#[cfg(test)]
mod tests {
use super::*;
use capabilities::SpecNewSessionParameters;
use crate::capabilities::SpecNewSessionParameters;
use crate::test::check_deserialize;
use serde_json;
use test::check_deserialize;
#[test]
fn test_json_actions_parameters_missing_actions_field() {

View File

@ -70,8 +70,8 @@ impl WebElement {
#[cfg(test)]
mod tests {
use super::*;
use crate::test::{check_serialize, check_serialize_deserialize};
use serde_json;
use test::{check_serialize, check_serialize_deserialize};
#[test]
fn test_json_date() {

View File

@ -363,7 +363,7 @@ impl From<Box<Error>> for WebDriverError {
#[cfg(test)]
mod tests {
use super::*;
use test::check_serialize;
use crate::test::check_serialize;
#[test]
fn test_json_webdriver_error() {

View File

@ -3,9 +3,10 @@ use regex::{Captures, Regex};
use hyper::Method;
use serde_json::Value;
use command::{VoidWebDriverExtensionCommand, WebDriverCommand, WebDriverExtensionCommand,
WebDriverMessage};
use error::{ErrorStatus, WebDriverError, WebDriverResult};
use crate::command::{
VoidWebDriverExtensionCommand, WebDriverCommand, WebDriverExtensionCommand, WebDriverMessage,
};
use crate::error::{ErrorStatus, WebDriverError, WebDriverResult};
fn standard_routes<U: WebDriverExtensionRoute>() -> Vec<(Method, &'static str, Route<U>)> {
return vec![
@ -282,7 +283,7 @@ pub enum Route<U: WebDriverExtensionRoute> {
pub trait WebDriverExtensionRoute: Clone + Send + PartialEq {
type Command: WebDriverExtensionCommand + 'static;
fn command(&self, &Captures, &Value) -> WebDriverResult<WebDriverCommand<Self::Command>>;
fn command(&self, _: &Captures, _: &Value) -> WebDriverResult<WebDriverCommand<Self::Command>>;
}
#[derive(Clone, Debug, PartialEq)]

View File

@ -1,4 +1,4 @@
use common::Cookie;
use crate::common::Cookie;
use serde::ser::{Serialize, Serializer};
use serde_json::Value;
@ -129,9 +129,9 @@ pub struct WindowRectResponse {
#[cfg(test)]
mod tests {
use super::*;
use common::Date;
use crate::common::Date;
use crate::test::check_serialize;
use serde_json;
use test::check_serialize;
#[test]
fn test_json_close_window_response() {

View File

@ -6,18 +6,18 @@ use std::sync::{Arc, Mutex};
use std::thread;
use futures::{future, Future, Stream};
use hyper::{self, Body, Method, Request, Response, StatusCode};
use hyper::service::Service;
use hyper::server::conn::Http;
use http;
use tokio::runtime::current_thread::Runtime;
use tokio::reactor::Handle;
use hyper::server::conn::Http;
use hyper::service::Service;
use hyper::{self, Body, Method, Request, Response, StatusCode};
use tokio::net::TcpListener;
use tokio::reactor::Handle;
use tokio::runtime::current_thread::Runtime;
use command::{WebDriverCommand, WebDriverMessage};
use error::{ErrorStatus, WebDriverError, WebDriverResult};
use httpapi::{VoidWebDriverExtensionRoute, WebDriverExtensionRoute, WebDriverHttpApi};
use response::{CloseWindowResponse, WebDriverResponse};
use crate::command::{WebDriverCommand, WebDriverMessage};
use crate::error::{ErrorStatus, WebDriverError, WebDriverResult};
use crate::httpapi::{VoidWebDriverExtensionRoute, WebDriverExtensionRoute, WebDriverHttpApi};
use crate::response::{CloseWindowResponse, WebDriverResponse};
// Silence warning about Quit being unused for now.
#[allow(dead_code)]