Commit a32149f604
Unregistered key
Layout: unified · split
flake.nix +8 −5
| @@ -30,16 +30,15 @@ | ||
| 30 | 30 | rustToolchain = fenix.packages.${system}.fromToolchainFile { |
| 31 | 31 | file = ./rust-toolchain.toml; |
| 32 | 32 | # When the file changes, this hash must be updated. |
| 33 | sha256 = "sha256-Hn2uaQzRLidAWpfmRwSRdImifGUCAb9HeAqTYFXWeQk="; | |
| 33 | sha256 = "sha256-Qxt8XAuaUR2OMdKbN4u8dBJOhSHxS+uS06Wl9+flVEk="; | |
| 34 | 34 | }; |
| 35 | 35 | |
| 36 | 36 | # Nightly toolchain for rustfmt (pinned to current flake lock) |
| 37 | 37 | # Note that the github CI uses "current nightly" for formatting, it 's not pinned. |
| 38 | rustNightly = fenix.packages.${system}.latest.toolchain; | |
| 39 | rustNightlyFmt = fenix.packages.${system}.latest.rustfmt; | |
| 38 | rustNightly = fenix.packages.${system}.latest; | |
| 40 | 39 | |
| 41 | 40 | craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; |
| 42 | craneLibNightly = (crane.mkLib pkgs).overrideToolchain rustNightly; | |
| 41 | craneLibNightly = (crane.mkLib pkgs).overrideToolchain rustNightly.toolchain; | |
| 43 | 42 | |
| 44 | 43 | src = lib.fileset.toSource { |
| 45 | 44 | root = ./.; |
| @@ -97,11 +96,15 @@ | ||
| 97 | 96 | checks = self.checks.${system}; |
| 98 | 97 | |
| 99 | 98 | packages = with pkgs; [ |
| 100 | rustNightlyFmt | |
| 101 | 99 | cargo-tarpaulin |
| 102 | 100 | cargo-watch |
| 103 | 101 | sqlite |
| 104 | 102 | ]; |
| 103 | ||
| 104 | shellHook = '' | |
| 105 | # Prepend nightly rustfmt to PATH. | |
| 106 | export PATH="${rustNightly.rustfmt}/bin:$PATH" | |
| 107 | ''; | |
| 105 | 108 | }; |
| 106 | 109 | } |
| 107 | 110 | ); |
src/base.rs +4 −4
| @@ -2049,7 +2049,7 @@ fn complete_msgbar(text: &EditRope, cursor: &mut Cursor, store: &ChatStore) -> V | ||
| 2049 | 2049 | // Complete Emoji shortcodes. |
| 2050 | 2050 | Some(':') => { |
| 2051 | 2051 | let list = store.emojis.complete(&id[1..]); |
| 2052 | let iter = list.into_iter().take(200).map(|s| format!(":{}:", s)); | |
| 2052 | let iter = list.into_iter().take(200).map(|s| format!(":{s}:")); | |
| 2053 | 2053 | |
| 2054 | 2054 | return iter.collect(); |
| 2055 | 2055 | }, |
| @@ -2195,7 +2195,7 @@ pub mod tests { | ||
| 2195 | 2195 | )); |
| 2196 | 2196 | |
| 2197 | 2197 | for i in 0..3 { |
| 2198 | let event_id = format!("$house_{}", i); | |
| 2198 | let event_id = format!("$house_{i}"); | |
| 2199 | 2199 | info.insert_reaction(MessageLikeEvent::Original( |
| 2200 | 2200 | matrix_sdk::ruma::events::OriginalMessageLikeEvent { |
| 2201 | 2201 | content: content.clone(), |
| @@ -2214,7 +2214,7 @@ pub mod tests { | ||
| 2214 | 2214 | )); |
| 2215 | 2215 | |
| 2216 | 2216 | for i in 0..2 { |
| 2217 | let event_id = format!("$smile_{}", i); | |
| 2217 | let event_id = format!("$smile_{i}"); | |
| 2218 | 2218 | info.insert_reaction(MessageLikeEvent::Original( |
| 2219 | 2219 | matrix_sdk::ruma::events::OriginalMessageLikeEvent { |
| 2220 | 2220 | content: content.clone(), |
| @@ -2228,7 +2228,7 @@ pub mod tests { | ||
| 2228 | 2228 | } |
| 2229 | 2229 | |
| 2230 | 2230 | for i in 2..4 { |
| 2231 | let event_id = format!("$smile_{}", i); | |
| 2231 | let event_id = format!("$smile_{i}"); | |
| 2232 | 2232 | info.insert_reaction(MessageLikeEvent::Original( |
| 2233 | 2233 | matrix_sdk::ruma::events::OriginalMessageLikeEvent { |
| 2234 | 2234 | content: content.clone(), |
src/config.rs +1 −4
| @@ -932,10 +932,7 @@ impl ApplicationSettings { | ||
| 932 | 932 | } else { |
| 933 | 933 | loop { |
| 934 | 934 | println!("\nNo profile specified. Available profiles:"); |
| 935 | profiles | |
| 936 | .keys() | |
| 937 | .enumerate() | |
| 938 | .for_each(|(i, name)| println!("{}: {}", i, name)); | |
| 935 | profiles.keys().enumerate().for_each(|(i, name)| println!("{i}: {name}")); | |
| 939 | 936 | |
| 940 | 937 | print!("Select a number or 'q' to quit: "); |
| 941 | 938 | let _ = std::io::stdout().flush(); |
src/message/state.rs +15 −15
| @@ -121,11 +121,11 @@ pub fn body_cow_state(ev: &AnySyncStateEvent) -> Cow<'static, str> { | ||
| 121 | 121 | |
| 122 | 122 | match (old_canon, new_canon) { |
| 123 | 123 | (None, Some(canon)) => { |
| 124 | format!("* updated the canonical alias for the room to: {}", canon) | |
| 124 | format!("* updated the canonical alias for the room to: {canon}") | |
| 125 | 125 | }, |
| 126 | 126 | (Some(old), Some(new)) => { |
| 127 | 127 | if old != new { |
| 128 | format!("* updated the canonical alias for the room to: {}", new) | |
| 128 | format!("* updated the canonical alias for the room to: {new}") | |
| 129 | 129 | } else { |
| 130 | 130 | return Cow::Borrowed("* removed the canonical alias for the room"); |
| 131 | 131 | } |
| @@ -187,10 +187,10 @@ pub fn body_cow_state(ev: &AnySyncStateEvent) -> Cow<'static, str> { | ||
| 187 | 187 | |
| 188 | 188 | match change { |
| 189 | 189 | MembershipChange::None => { |
| 190 | format!("* did nothing to {}", state_key) | |
| 190 | format!("* did nothing to {state_key}") | |
| 191 | 191 | }, |
| 192 | 192 | MembershipChange::Error => { |
| 193 | format!("* failed to calculate membership change to {}", state_key) | |
| 193 | format!("* failed to calculate membership change to {state_key}") | |
| 194 | 194 | }, |
| 195 | 195 | MembershipChange::Joined => { |
| 196 | 196 | return Cow::Borrowed("* joined the room"); |
| @@ -199,19 +199,19 @@ pub fn body_cow_state(ev: &AnySyncStateEvent) -> Cow<'static, str> { | ||
| 199 | 199 | return Cow::Borrowed("* left the room"); |
| 200 | 200 | }, |
| 201 | 201 | MembershipChange::Banned => { |
| 202 | format!("* banned {} from the room", state_key) | |
| 202 | format!("* banned {state_key} from the room") | |
| 203 | 203 | }, |
| 204 | 204 | MembershipChange::Unbanned => { |
| 205 | format!("* unbanned {} from the room", state_key) | |
| 205 | format!("* unbanned {state_key} from the room") | |
| 206 | 206 | }, |
| 207 | 207 | MembershipChange::Kicked => { |
| 208 | format!("* kicked {} from the room", state_key) | |
| 208 | format!("* kicked {state_key} from the room") | |
| 209 | 209 | }, |
| 210 | 210 | MembershipChange::Invited => { |
| 211 | format!("* invited {} to the room", state_key) | |
| 211 | format!("* invited {state_key} to the room") | |
| 212 | 212 | }, |
| 213 | 213 | MembershipChange::KickedAndBanned => { |
| 214 | format!("* kicked and banned {} from the room", state_key) | |
| 214 | format!("* kicked and banned {state_key} from the room") | |
| 215 | 215 | }, |
| 216 | 216 | MembershipChange::InvitationAccepted => { |
| 217 | 217 | return Cow::Borrowed("* accepted an invitation to join the room"); |
| @@ -220,26 +220,26 @@ pub fn body_cow_state(ev: &AnySyncStateEvent) -> Cow<'static, str> { | ||
| 220 | 220 | return Cow::Borrowed("* rejected an invitation to join the room"); |
| 221 | 221 | }, |
| 222 | 222 | MembershipChange::InvitationRevoked => { |
| 223 | format!("* revoked an invitation for {} to join the room", state_key) | |
| 223 | format!("* revoked an invitation for {state_key} to join the room") | |
| 224 | 224 | }, |
| 225 | 225 | MembershipChange::Knocked => { |
| 226 | 226 | return Cow::Borrowed("* would like to join the room"); |
| 227 | 227 | }, |
| 228 | 228 | MembershipChange::KnockAccepted => { |
| 229 | format!("* accepted the room knock from {}", state_key) | |
| 229 | format!("* accepted the room knock from {state_key}") | |
| 230 | 230 | }, |
| 231 | 231 | MembershipChange::KnockRetracted => { |
| 232 | 232 | return Cow::Borrowed("* retracted their room knock"); |
| 233 | 233 | }, |
| 234 | 234 | MembershipChange::KnockDenied => { |
| 235 | format!("* rejected the room knock from {}", state_key) | |
| 235 | format!("* rejected the room knock from {state_key}") | |
| 236 | 236 | }, |
| 237 | 237 | MembershipChange::ProfileChanged { displayname_change, avatar_url_change } => { |
| 238 | 238 | match (displayname_change, avatar_url_change) { |
| 239 | 239 | (Some(change), avatar_change) => { |
| 240 | 240 | let mut m = match (change.old, change.new) { |
| 241 | 241 | (None, Some(new)) => { |
| 242 | format!("* set their display name to {:?}", new) | |
| 242 | format!("* set their display name to {new:?}") | |
| 243 | 243 | }, |
| 244 | 244 | (Some(old), Some(new)) => { |
| 245 | 245 | format!("* changed their display name from {old} to {new}") |
| @@ -280,7 +280,7 @@ pub fn body_cow_state(ev: &AnySyncStateEvent) -> Cow<'static, str> { | ||
| 280 | 280 | } |
| 281 | 281 | }, |
| 282 | 282 | ev => { |
| 283 | format!("* made an unknown membership change to {}: {:?}", state_key, ev) | |
| 283 | format!("* made an unknown membership change to {state_key}: {ev:?}") | |
| 284 | 284 | }, |
| 285 | 285 | } |
| 286 | 286 | }, |
| @@ -727,7 +727,7 @@ pub fn html_state(ev: &AnySyncStateEvent) -> StyleTree { | ||
| 727 | 727 | ev => { |
| 728 | 728 | let prefix = |
| 729 | 729 | StyleTreeNode::Text("* made an unknown membership change to ".into()); |
| 730 | let suffix = StyleTreeNode::Text(format!(": {:?}", ev).into()); | |
| 730 | let suffix = StyleTreeNode::Text(format!(": {ev:?}").into()); | |
| 731 | 731 | vec![prefix, user_id, suffix] |
| 732 | 732 | }, |
| 733 | 733 | } |
src/windows/room/chat.rs +3 −3
| @@ -273,9 +273,9 @@ impl ChatState { | ||
| 273 | 273 | let mut filename_incr = filename.clone(); |
| 274 | 274 | for n in 1..=1000 { |
| 275 | 275 | if let Some(ext) = ext.and_then(OsStr::to_str) { |
| 276 | filename_incr.set_file_name(format!("{}-{}.{}", stem, n, ext)); | |
| 276 | filename_incr.set_file_name(format!("{stem}-{n}.{ext}")); | |
| 277 | 277 | } else { |
| 278 | filename_incr.set_file_name(format!("{}-{}", stem, n)); | |
| 278 | filename_incr.set_file_name(format!("{stem}-{n}")); | |
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | if !filename_incr.exists() { |
| @@ -401,7 +401,7 @@ impl ChatState { | ||
| 401 | 401 | }; |
| 402 | 402 | |
| 403 | 403 | if info.user_reactions_contains(&settings.profile.user_id, &event_id, &emoji) { |
| 404 | let msg = format!("You’ve already reacted to this message with {}", emoji); | |
| 404 | let msg = format!("You’ve already reacted to this message with {emoji}"); | |
| 405 | 405 | let err = UIError::Failure(msg); |
| 406 | 406 | |
| 407 | 407 | return Err(err); |
src/windows/room/mod.rs +6 −6
| @@ -120,19 +120,19 @@ fn hist_visibility_mode(name: impl Into<String>) -> IambResult<HistoryVisibility | ||
| 120 | 120 | /// that operations like sending and accepting invites, opening the members window, etc., all work |
| 121 | 121 | /// similarly. |
| 122 | 122 | pub enum RoomState { |
| 123 | Chat(ChatState), | |
| 124 | Space(SpaceState), | |
| 123 | Chat(Box<ChatState>), | |
| 124 | Space(Box<SpaceState>), | |
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | impl From<ChatState> for RoomState { |
| 128 | 128 | fn from(chat: ChatState) -> Self { |
| 129 | RoomState::Chat(chat) | |
| 129 | RoomState::Chat(Box::new(chat)) | |
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | impl From<SpaceState> for RoomState { |
| 134 | 134 | fn from(space: SpaceState) -> Self { |
| 135 | RoomState::Space(space) | |
| 135 | RoomState::Space(Box::new(space)) | |
| 136 | 136 | } |
| 137 | 137 | } |
| 138 | 138 | |
| @@ -776,8 +776,8 @@ impl WindowOps<IambInfo> for RoomState { | ||
| 776 | 776 | |
| 777 | 777 | fn dup(&self, store: &mut ProgramStore) -> Self { |
| 778 | 778 | match self { |
| 779 | RoomState::Chat(chat) => RoomState::Chat(chat.dup(store)), | |
| 780 | RoomState::Space(space) => RoomState::Space(space.dup(store)), | |
| 779 | RoomState::Chat(chat) => RoomState::Chat(Box::new(chat.dup(store))), | |
| 780 | RoomState::Space(space) => RoomState::Space(Box::new(space.dup(store))), | |
| 781 | 781 | } |
| 782 | 782 | } |
| 783 | 783 | |