Fix use-self

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-06-09 10:23:06 +00:00
parent c3c91e9d80
commit eae41fc411
18 changed files with 47 additions and 48 deletions

View file

@ -75,7 +75,7 @@ impl TryFrom<Vec<Namespace>> for NamespaceRegex {
}
}
Ok(NamespaceRegex {
Ok(Self {
exclusive: if exclusive.is_empty() {
None
} else {
@ -102,8 +102,8 @@ pub struct RegistrationInfo {
impl TryFrom<Registration> for RegistrationInfo {
type Error = regex::Error;
fn try_from(value: Registration) -> Result<RegistrationInfo, regex::Error> {
Ok(RegistrationInfo {
fn try_from(value: Registration) -> Result<Self, regex::Error> {
Ok(Self {
users: value.namespaces.users.clone().try_into()?,
aliases: value.namespaces.aliases.clone().try_into()?,
rooms: value.namespaces.rooms.clone().try_into()?,

View file

@ -15,8 +15,8 @@ pub struct Client {
}
impl Client {
pub fn new(config: &Config, resolver: &Arc<resolver::Resolver>) -> Client {
Client {
pub fn new(config: &Config, resolver: &Arc<resolver::Resolver>) -> Self {
Self {
default: Self::base(config)
.unwrap()
.dns_resolver(resolver.clone())

View file

@ -83,7 +83,7 @@ impl Resolver {
let resolver = Arc::new(TokioAsyncResolver::tokio(conf, opts));
let overrides = Arc::new(StdRwLock::new(TlsNameMap::new()));
Resolver {
Self {
destinations: Arc::new(RwLock::new(WellKnownMap::new())),
overrides: overrides.clone(),
resolver: resolver.clone(),

View file

@ -56,7 +56,7 @@ pub struct PduEvent {
impl PduEvent {
#[tracing::instrument(skip(self))]
pub fn redact(&mut self, room_version_id: RoomVersionId, reason: &PduEvent) -> crate::Result<()> {
pub fn redact(&mut self, room_version_id: RoomVersionId, reason: &Self) -> crate::Result<()> {
self.unsigned = None;
let mut content = serde_json::from_str(self.content.get())

View file

@ -211,7 +211,7 @@ impl Arena {
fn new(root: OwnedRoomId, max_depth: usize) -> Self {
let zero_depth = max_depth == 0;
Arena {
Self {
nodes: vec![Node {
parent: None,
next_sibling: None,
@ -248,7 +248,7 @@ impl FromStr for PagnationToken {
let mut values = value.split('_');
let mut pag_tok = || {
Some(PagnationToken {
Some(Self {
skip: UInt::from_str(values.next()?).ok()?,
limit: UInt::from_str(values.next()?).ok()?,
max_depth: UInt::from_str(values.next()?).ok()?,
@ -316,7 +316,7 @@ impl From<CachedSpaceHierarchySummary> for SpaceHierarchyRoomsChunk {
..
} = value.summary;
SpaceHierarchyRoomsChunk {
Self {
canonical_alias,
name,
num_joined_members,

View file

@ -259,19 +259,19 @@ impl Destination {
#[tracing::instrument(skip(self))]
pub fn get_prefix(&self) -> Vec<u8> {
let mut prefix = match self {
Destination::Appservice(server) => {
Self::Appservice(server) => {
let mut p = b"+".to_vec();
p.extend_from_slice(server.as_bytes());
p
},
Destination::Push(user, pushkey) => {
Self::Push(user, pushkey) => {
let mut p = b"$".to_vec();
p.extend_from_slice(user.as_bytes());
p.push(0xFF);
p.extend_from_slice(pushkey.as_bytes());
p
},
Destination::Normal(server) => {
Self::Normal(server) => {
let mut p = Vec::new();
p.extend_from_slice(server.as_bytes());
p

View file

@ -421,8 +421,8 @@ impl FedDest {
impl fmt::Display for FedDest {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
FedDest::Named(host, port) => write!(f, "{host}{port}"),
FedDest::Literal(addr) => write!(f, "{addr}"),
Self::Named(host, port) => write!(f, "{host}{port}"),
Self::Literal(addr) => write!(f, "{addr}"),
}
}
}