Simplify &self in function definitions

This commit is contained in:
Tobie Morgan Hitchcock 2022-04-05 14:53:27 +01:00
parent c1a128e7ab
commit 200741a35e

View file

@ -88,7 +88,7 @@ impl fmt::Display for Statement {
impl Statement { impl Statement {
// Returns any query fields if specified // Returns any query fields if specified
#[inline] #[inline]
pub fn expr(self: &Statement) -> Option<&Fields> { pub fn expr(&self) -> Option<&Fields> {
match self { match self {
Statement::Select(v) => Some(&v.expr), Statement::Select(v) => Some(&v.expr),
_ => None, _ => None,
@ -96,7 +96,7 @@ impl Statement {
} }
// Returns any SET clause if specified // Returns any SET clause if specified
#[inline] #[inline]
pub fn data(self: &Statement) -> Option<&Data> { pub fn data(&self) -> Option<&Data> {
match self { match self {
Statement::Create(v) => v.data.as_ref(), Statement::Create(v) => v.data.as_ref(),
Statement::Update(v) => v.data.as_ref(), Statement::Update(v) => v.data.as_ref(),
@ -105,7 +105,7 @@ impl Statement {
} }
// Returns any WHERE clause if specified // Returns any WHERE clause if specified
#[inline] #[inline]
pub fn conds(self: &Statement) -> Option<&Cond> { pub fn conds(&self) -> Option<&Cond> {
match self { match self {
Statement::Select(v) => v.cond.as_ref(), Statement::Select(v) => v.cond.as_ref(),
Statement::Update(v) => v.cond.as_ref(), Statement::Update(v) => v.cond.as_ref(),
@ -115,7 +115,7 @@ impl Statement {
} }
// Returns any SPLIT clause if specified // Returns any SPLIT clause if specified
#[inline] #[inline]
pub fn split(self: &Statement) -> Option<&Splits> { pub fn split(&self) -> Option<&Splits> {
match self { match self {
Statement::Select(v) => v.split.as_ref(), Statement::Select(v) => v.split.as_ref(),
_ => None, _ => None,
@ -123,7 +123,7 @@ impl Statement {
} }
// Returns any GROUP clause if specified // Returns any GROUP clause if specified
#[inline] #[inline]
pub fn group(self: &Statement) -> Option<&Groups> { pub fn group(&self) -> Option<&Groups> {
match self { match self {
Statement::Select(v) => v.group.as_ref(), Statement::Select(v) => v.group.as_ref(),
_ => None, _ => None,
@ -131,7 +131,7 @@ impl Statement {
} }
// Returns any ORDER clause if specified // Returns any ORDER clause if specified
#[inline] #[inline]
pub fn order(self: &Statement) -> Option<&Orders> { pub fn order(&self) -> Option<&Orders> {
match self { match self {
Statement::Select(v) => v.order.as_ref(), Statement::Select(v) => v.order.as_ref(),
_ => None, _ => None,
@ -139,7 +139,7 @@ impl Statement {
} }
// Returns any FETCH clause if specified // Returns any FETCH clause if specified
#[inline] #[inline]
pub fn fetch(self: &Statement) -> Option<&Fetchs> { pub fn fetch(&self) -> Option<&Fetchs> {
match self { match self {
Statement::Select(v) => v.fetch.as_ref(), Statement::Select(v) => v.fetch.as_ref(),
_ => None, _ => None,
@ -147,7 +147,7 @@ impl Statement {
} }
// Returns any START clause if specified // Returns any START clause if specified
#[inline] #[inline]
pub fn start(self: &Statement) -> Option<&Start> { pub fn start(&self) -> Option<&Start> {
match self { match self {
Statement::Select(v) => v.start.as_ref(), Statement::Select(v) => v.start.as_ref(),
_ => None, _ => None,
@ -155,7 +155,7 @@ impl Statement {
} }
// Returns any LIMIT clause if specified // Returns any LIMIT clause if specified
#[inline] #[inline]
pub fn limit(self: &Statement) -> Option<&Limit> { pub fn limit(&self) -> Option<&Limit> {
match self { match self {
Statement::Select(v) => v.limit.as_ref(), Statement::Select(v) => v.limit.as_ref(),
_ => None, _ => None,
@ -163,7 +163,7 @@ impl Statement {
} }
// Returns any RETURN clause if specified // Returns any RETURN clause if specified
#[inline] #[inline]
pub fn output(self: &Statement) -> Option<&Output> { pub fn output(&self) -> Option<&Output> {
match self { match self {
Statement::Create(v) => v.output.as_ref(), Statement::Create(v) => v.output.as_ref(),
Statement::Update(v) => v.output.as_ref(), Statement::Update(v) => v.output.as_ref(),
@ -175,7 +175,7 @@ impl Statement {
} }
// Returns any VERSION clause if specified // Returns any VERSION clause if specified
#[inline] #[inline]
pub fn version(self: &Statement) -> Option<&Version> { pub fn version(&self) -> Option<&Version> {
match self { match self {
Statement::Select(v) => v.version.as_ref(), Statement::Select(v) => v.version.as_ref(),
_ => None, _ => None,