Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
rustToolchain = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
# When the file changes, this hash must be updated.
sha256 = "sha256-Hn2uaQzRLidAWpfmRwSRdImifGUCAb9HeAqTYFXWeQk=";
sha256 = "sha256-Qxt8XAuaUR2OMdKbN4u8dBJOhSHxS+uS06Wl9+flVEk=";
};

# Nightly toolchain for rustfmt (pinned to current flake lock)
Expand Down
8 changes: 4 additions & 4 deletions src/base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2019,7 +2019,7 @@ fn complete_msgbar(text: &EditRope, cursor: &mut Cursor, store: &ChatStore) -> V
// Complete Emoji shortcodes.
Some(':') => {
let list = store.emojis.complete(&id[1..]);
let iter = list.into_iter().take(200).map(|s| format!(":{}:", s));
let iter = list.into_iter().take(200).map(|s| format!(":{s}:"));

return iter.collect();
},
Expand Down Expand Up @@ -2165,7 +2165,7 @@ pub mod tests {
));

for i in 0..3 {
let event_id = format!("$house_{}", i);
let event_id = format!("$house_{i}");
info.insert_reaction(MessageLikeEvent::Original(
matrix_sdk::ruma::events::OriginalMessageLikeEvent {
content: content.clone(),
Expand All @@ -2184,7 +2184,7 @@ pub mod tests {
));

for i in 0..2 {
let event_id = format!("$smile_{}", i);
let event_id = format!("$smile_{i}");
info.insert_reaction(MessageLikeEvent::Original(
matrix_sdk::ruma::events::OriginalMessageLikeEvent {
content: content.clone(),
Expand All @@ -2198,7 +2198,7 @@ pub mod tests {
}

for i in 2..4 {
let event_id = format!("$smile_{}", i);
let event_id = format!("$smile_{i}");
info.insert_reaction(MessageLikeEvent::Original(
matrix_sdk::ruma::events::OriginalMessageLikeEvent {
content: content.clone(),
Expand Down
5 changes: 1 addition & 4 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -932,10 +932,7 @@ impl ApplicationSettings {
} else {
loop {
println!("\nNo profile specified. Available profiles:");
profiles
.keys()
.enumerate()
.for_each(|(i, name)| println!("{}: {}", i, name));
profiles.keys().enumerate().for_each(|(i, name)| println!("{i}: {name}"));

print!("Select a number or 'q' to quit: ");
let _ = std::io::stdout().flush();
Expand Down
30 changes: 15 additions & 15 deletions src/message/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,11 @@ pub fn body_cow_state(ev: &AnySyncStateEvent) -> Cow<'static, str> {

match (old_canon, new_canon) {
(None, Some(canon)) => {
format!("* updated the canonical alias for the room to: {}", canon)
format!("* updated the canonical alias for the room to: {canon}")
},
(Some(old), Some(new)) => {
if old != new {
format!("* updated the canonical alias for the room to: {}", new)
format!("* updated the canonical alias for the room to: {new}")
} else {
return Cow::Borrowed("* removed the canonical alias for the room");
}
Expand Down Expand Up @@ -187,10 +187,10 @@ pub fn body_cow_state(ev: &AnySyncStateEvent) -> Cow<'static, str> {

match change {
MembershipChange::None => {
format!("* did nothing to {}", state_key)
format!("* did nothing to {state_key}")
},
MembershipChange::Error => {
format!("* failed to calculate membership change to {}", state_key)
format!("* failed to calculate membership change to {state_key}")
},
MembershipChange::Joined => {
return Cow::Borrowed("* joined the room");
Expand All @@ -199,19 +199,19 @@ pub fn body_cow_state(ev: &AnySyncStateEvent) -> Cow<'static, str> {
return Cow::Borrowed("* left the room");
},
MembershipChange::Banned => {
format!("* banned {} from the room", state_key)
format!("* banned {state_key} from the room")
},
MembershipChange::Unbanned => {
format!("* unbanned {} from the room", state_key)
format!("* unbanned {state_key} from the room")
},
MembershipChange::Kicked => {
format!("* kicked {} from the room", state_key)
format!("* kicked {state_key} from the room")
},
MembershipChange::Invited => {
format!("* invited {} to the room", state_key)
format!("* invited {state_key} to the room")
},
MembershipChange::KickedAndBanned => {
format!("* kicked and banned {} from the room", state_key)
format!("* kicked and banned {state_key} from the room")
},
MembershipChange::InvitationAccepted => {
return Cow::Borrowed("* accepted an invitation to join the room");
Expand All @@ -220,26 +220,26 @@ pub fn body_cow_state(ev: &AnySyncStateEvent) -> Cow<'static, str> {
return Cow::Borrowed("* rejected an invitation to join the room");
},
MembershipChange::InvitationRevoked => {
format!("* revoked an invitation for {} to join the room", state_key)
format!("* revoked an invitation for {state_key} to join the room")
},
MembershipChange::Knocked => {
return Cow::Borrowed("* would like to join the room");
},
MembershipChange::KnockAccepted => {
format!("* accepted the room knock from {}", state_key)
format!("* accepted the room knock from {state_key}")
},
MembershipChange::KnockRetracted => {
return Cow::Borrowed("* retracted their room knock");
},
MembershipChange::KnockDenied => {
format!("* rejected the room knock from {}", state_key)
format!("* rejected the room knock from {state_key}")
},
MembershipChange::ProfileChanged { displayname_change, avatar_url_change } => {
match (displayname_change, avatar_url_change) {
(Some(change), avatar_change) => {
let mut m = match (change.old, change.new) {
(None, Some(new)) => {
format!("* set their display name to {:?}", new)
format!("* set their display name to {new:?}")
},
(Some(old), Some(new)) => {
format!("* changed their display name from {old} to {new}")
Expand Down Expand Up @@ -280,7 +280,7 @@ pub fn body_cow_state(ev: &AnySyncStateEvent) -> Cow<'static, str> {
}
},
ev => {
format!("* made an unknown membership change to {}: {:?}", state_key, ev)
format!("* made an unknown membership change to {state_key}: {ev:?}")
},
}
},
Expand Down Expand Up @@ -727,7 +727,7 @@ pub fn html_state(ev: &AnySyncStateEvent) -> StyleTree {
ev => {
let prefix =
StyleTreeNode::Text("* made an unknown membership change to ".into());
let suffix = StyleTreeNode::Text(format!(": {:?}", ev).into());
let suffix = StyleTreeNode::Text(format!(": {ev:?}").into());
vec![prefix, user_id, suffix]
},
}
Expand Down
6 changes: 3 additions & 3 deletions src/windows/room/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ impl ChatState {
let mut filename_incr = filename.clone();
for n in 1..=1000 {
if let Some(ext) = ext.and_then(OsStr::to_str) {
filename_incr.set_file_name(format!("{}-{}.{}", stem, n, ext));
filename_incr.set_file_name(format!("{stem}-{n}.{ext}"));
} else {
filename_incr.set_file_name(format!("{}-{}", stem, n));
filename_incr.set_file_name(format!("{stem}-{n}"));
}

if !filename_incr.exists() {
Expand Down Expand Up @@ -401,7 +401,7 @@ impl ChatState {
};

if info.user_reactions_contains(&settings.profile.user_id, &event_id, &emoji) {
let msg = format!("You’ve already reacted to this message with {}", emoji);
let msg = format!("You’ve already reacted to this message with {emoji}");
let err = UIError::Failure(msg);

return Err(err);
Expand Down
12 changes: 6 additions & 6 deletions src/windows/room/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,19 +120,19 @@ fn hist_visibility_mode(name: impl Into<String>) -> IambResult<HistoryVisibility
/// that operations like sending and accepting invites, opening the members window, etc., all work
/// similarly.
pub enum RoomState {
Chat(ChatState),
Space(SpaceState),
Chat(Box<ChatState>),
Space(Box<SpaceState>),
}

impl From<ChatState> for RoomState {
fn from(chat: ChatState) -> Self {
RoomState::Chat(chat)
RoomState::Chat(Box::new(chat))
}
}

impl From<SpaceState> for RoomState {
fn from(space: SpaceState) -> Self {
RoomState::Space(space)
RoomState::Space(Box::new(space))
}
}

Expand Down Expand Up @@ -776,8 +776,8 @@ impl WindowOps<IambInfo> for RoomState {

fn dup(&self, store: &mut ProgramStore) -> Self {
match self {
RoomState::Chat(chat) => RoomState::Chat(chat.dup(store)),
RoomState::Space(space) => RoomState::Space(space.dup(store)),
RoomState::Chat(chat) => RoomState::Chat(Box::new(chat.dup(store))),
RoomState::Space(space) => RoomState::Space(Box::new(space.dup(store))),
}
}

Expand Down
Loading