use 'Self' to refer to own type

This commit is contained in:
daniel.eades 2023-11-16 18:32:31 +00:00 committed by Ashley Wulber
parent a88cbad37f
commit b9723dd5e0
15 changed files with 48 additions and 54 deletions

View file

@ -52,12 +52,12 @@ enum NewConnectionState {
impl NewConnectionState {
pub fn ssid(&self) -> &str {
&match self {
NewConnectionState::EnterPassword {
Self::EnterPassword {
access_point,
password: _,
} => access_point,
NewConnectionState::Waiting(ap) => ap,
NewConnectionState::Failure(ap) => ap,
Self::Waiting(ap) => ap,
Self::Failure(ap) => ap,
}
.ssid
}
@ -66,12 +66,12 @@ impl NewConnectionState {
impl Into<AccessPoint> for NewConnectionState {
fn into(self) -> AccessPoint {
match self {
NewConnectionState::EnterPassword {
Self::EnterPassword {
access_point,
password: _,
} => access_point,
NewConnectionState::Waiting(access_point) => access_point,
NewConnectionState::Failure(access_point) => access_point,
Self::Waiting(access_point) => access_point,
Self::Failure(access_point) => access_point,
}
}
}
@ -192,7 +192,7 @@ impl cosmic::Application for CosmicNetworkApplet {
fn init(core: cosmic::app::Core, _flags: ()) -> (Self, Command<Message>) {
(
CosmicNetworkApplet {
Self {
core,
icon_name: "network-offline-symbolic".to_string(),
..Default::default()

View file

@ -103,9 +103,9 @@ pub enum ActiveConnectionInfo {
impl ActiveConnectionInfo {
pub fn name(&self) -> String {
match &self {
ActiveConnectionInfo::Wired { name, .. } => name.clone(),
ActiveConnectionInfo::WiFi { name, .. } => name.clone(),
ActiveConnectionInfo::Vpn { name, .. } => name.clone(),
Self::Wired { name, .. } => name.clone(),
Self::WiFi { name, .. } => name.clone(),
Self::Vpn { name, .. } => name.clone(),
}
}
}