From aec3a2fa54a457f7f149500a8ac2cb0122fd1560 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Wed, 4 May 2022 21:55:34 +0100 Subject: [PATCH] Switch to deriving Deref Signed-off-by: Ian Jackson --- wdriver/wdriver.rs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/wdriver/wdriver.rs b/wdriver/wdriver.rs index 0b47d7d9..54ab3a9d 100644 --- a/wdriver/wdriver.rs +++ b/wdriver/wdriver.rs @@ -30,10 +30,10 @@ use once_cell::sync::OnceCell; pub use std::rc::Rc; -#[derive(Debug,Clone)] +#[derive(Debug,Clone,Deref)] #[derive(StructOpt)] pub struct Opts { - #[structopt(flatten)] + #[structopt(flatten)] #[deref] at: apitest::Opts, #[structopt(long="--layout", default_value="Portrait")] @@ -42,7 +42,6 @@ pub struct Opts { #[structopt(long="--geckodriver-args", default_value="")] geckodriver_args: String, } -deref_to_field!{Opts, apitest::Opts, at} impl AsRef for Opts { fn as_ref(&self) -> &apitest::Opts { &self.at } } @@ -53,17 +52,16 @@ pub struct FinalInfoCollection; type ScreenShotCount = u32; type WindowState = Option; -#[derive(Debug)] +#[derive(Debug,Deref,DerefMut)] pub struct Setup { pub opts: Opts, - pub core: SetupCore, + #[deref] #[deref_mut] pub core: SetupCore, driver: T4d, current_window: WindowState, screenshot_count: ScreenShotCount, #[allow(dead_code)] /* here for Drop impl */ final_hook: FinalInfoCollection, windows_squirreled: Vec, // see Drop impl } -deref_to_field_mut!{Setup, SetupCore, core} #[derive(Debug)] pub struct Window { @@ -491,12 +489,12 @@ impl Vec { pub type WebCoord = i32; pub type WebPos = (WebCoord, WebCoord); +#[derive(Deref)] pub struct PieceElement<'g> { pieceid: Vpid, w: &'g WindowGuard<'g>, - elem: t4::WebElement<'g>, + #[deref] elem: t4::WebElement<'g>, } -deref_to_field!{{'g} PieceElement<'g>, t4::WebElement<'g>, elem} impl<'g> PieceElement<'g> { #[throws(AE)] -- 2.30.2