From: Ian Jackson Date: Wed, 4 May 2022 20:55:34 +0000 (+0100) Subject: Switch to deriving Deref X-Git-Tag: otter-1.1.0~283 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=aec3a2fa54a457f7f149500a8ac2cb0122fd1560;p=otter.git Switch to deriving Deref Signed-off-by: Ian Jackson --- 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)]