on master help sign in
Update to rust 1.56 + 2021 edition
commit182a59b5528075c0171756bff71275db8a7995f0 authorBlaž Hrastnik <blaz@mxxn.io> dateFri 22 Oct 2021, 12:07 (5 years ago) parent3b032e8
11 files changed+82−56
flake.lock+52−16 flake.nix+2 helix-core/Cargo.toml+1−1 helix-lsp/Cargo.toml+1−1 helix-syntax/Cargo.toml+1−1 helix-term/Cargo.toml+1−1 helix-term/src/ui/menu.rs+15−17 helix-term/src/ui/picker.rs+7−16 helix-tui/Cargo.toml+1−1 helix-view/Cargo.toml+1−1 helix-view/src/theme.rs−1
flake.lock+52−16
@@ -2,11 +2,11 @@
22 "nodes": {
33 "devshell": {
44 "locked": {
5− "lastModified": 1630239564,
6− "narHash": "sha256-lv7atkVE1+dFw0llmzONsbSIo5ao85KpNSRoFk4K8vU=",
5+ "lastModified": 1632436039,
6+ "narHash": "sha256-OtITeVWcKXn1SpVEnImpTGH91FycCskGBPqmlxiykv4=",
77 "owner": "numtide",
88 "repo": "devshell",
9− "rev": "bd86d3a2bb28ce4d223315e0eca0d59fef8a0a73",
9+ "rev": "7a7a7aa0adebe5488e5abaec688fd9ae0f8ea9c6",
1010 "type": "github"
1111 },
1212 "original": {
@@ -15,6 +15,21 @@
1515 "type": "github"
1616 }
1717 },
18+ "flake-utils": {
19+ "locked": {
20+ "lastModified": 1623875721,
21+ "narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
22+ "owner": "numtide",
23+ "repo": "flake-utils",
24+ "rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
25+ "type": "github"
26+ },
27+ "original": {
28+ "owner": "numtide",
29+ "repo": "flake-utils",
30+ "type": "github"
31+ }
32+ },
1833 "flakeCompat": {
1934 "flake": false,
2035 "locked": {
@@ -37,14 +52,16 @@
3752 "nixpkgs": [
3853 "nixpkgs"
3954 ],
40− "rustOverlay": "rustOverlay"
55+ "rustOverlay": [
56+ "rust-overlay"
57+ ]
4158 },
4259 "locked": {
43− "lastModified": 1631254163,
44− "narHash": "sha256-8+nOGLH1fXwWnNMTQq/Igk434BzZF5Vld45xLDLiNDQ=",
60+ "lastModified": 1634796585,
61+ "narHash": "sha256-CW4yx6omk5qCXUIwXHp/sztA7u0SpyLq9NEACPnkiz8=",
4562 "owner": "yusdacra",
4663 "repo": "nix-cargo-integration",
47− "rev": "432d8504a32232e8d74710024d5bf5cc31767651",
64+ "rev": "a84a2137a396f303978f1d48341e0390b0e16a8b",
4865 "type": "github"
4966 },
5067 "original": {
@@ -55,11 +72,11 @@
5572 },
5673 "nixpkgs": {
5774 "locked": {
58− "lastModified": 1631206977,
59− "narHash": "sha256-o3Dct9aJ5ht5UaTUBzXrRcK1RZt2eG5/xSlWJuUCVZM=",
75+ "lastModified": 1634782485,
76+ "narHash": "sha256-psfh4OQSokGXG0lpq3zKFbhOo3QfoeudRcaUnwMRkQo=",
6077 "owner": "nixos",
6178 "repo": "nixpkgs",
62− "rev": "4f6d8095fd51954120a1d08ea5896fe42dc3923b",
79+ "rev": "34ad3ffe08adfca17fcb4e4a47bb5f3b113687be",
6380 "type": "github"
6481 },
6582 "original": {
@@ -69,21 +86,40 @@
6986 "type": "github"
7087 }
7188 },
89+ "nixpkgs_2": {
90+ "locked": {
91+ "lastModified": 1628186154,
92+ "narHash": "sha256-r2d0wvywFnL9z4iptztdFMhaUIAaGzrSs7kSok0PgmE=",
93+ "owner": "NixOS",
94+ "repo": "nixpkgs",
95+ "rev": "06552b72346632b6943c8032e57e702ea12413bf",
96+ "type": "github"
97+ },
98+ "original": {
99+ "owner": "NixOS",
100+ "repo": "nixpkgs",
101+ "type": "github"
102+ }
103+ },
72104 "root": {
73105 "inputs": {
74106 "flakeCompat": "flakeCompat",
75107 "nixCargoIntegration": "nixCargoIntegration",
76− "nixpkgs": "nixpkgs"
108+ "nixpkgs": "nixpkgs",
109+ "rust-overlay": "rust-overlay"
77110 }
78111 },
79− "rustOverlay": {
80− "flake": false,
112+ "rust-overlay": {
113+ "inputs": {
114+ "flake-utils": "flake-utils",
115+ "nixpkgs": "nixpkgs_2"
116+ },
81117 "locked": {
82− "lastModified": 1631240108,
83− "narHash": "sha256-ffsTkAGyQLxu4E28nVcqwc8xFL/H1UEwrRw2ITI43Aw=",
118+ "lastModified": 1634869268,
119+ "narHash": "sha256-RVAcEFlFU3877Mm4q/nbXGEYTDg/wQNhzmXGMTV6wBs=",
84120 "owner": "oxalica",
85121 "repo": "rust-overlay",
86− "rev": "3a29d5e726b855d9463eb5dfe04f1ec14d413289",
122+ "rev": "c02c2d86354327317546501af001886fbb53d374",
87123 "type": "github"
88124 },
89125 "original": {
flake.nix+2
@@ -3,9 +3,11 @@
33
44 inputs = {
55 nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
6+ rust-overlay.url = "github:oxalica/rust-overlay";
67 nixCargoIntegration = {
78 url = "github:yusdacra/nix-cargo-integration";
89 inputs.nixpkgs.follows = "nixpkgs";
10+ inputs.rustOverlay.follows = "rust-overlay";
911 };
1012 flakeCompat = {
1113 url = "github:edolstra/flake-compat";
helix-core/Cargo.toml+1−1
@@ -2,7 +2,7 @@
22name = "helix-core"
33version = "0.4.1"
44authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−edition = "2018"
5+edition = "2021"
66license = "MPL-2.0"
77description = "Helix editor core editing primitives"
88categories = ["editor"]
helix-lsp/Cargo.toml+1−1
@@ -2,7 +2,7 @@
22name = "helix-lsp"
33version = "0.4.1"
44authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−edition = "2018"
5+edition = "2021"
66license = "MPL-2.0"
77description = "LSP client implementation for Helix project"
88categories = ["editor"]
helix-syntax/Cargo.toml+1−1
@@ -2,7 +2,7 @@
22name = "helix-syntax"
33version = "0.4.1"
44authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−edition = "2018"
5+edition = "2021"
66license = "MPL-2.0"
77description = "Tree-sitter grammars support"
88categories = ["editor"]
helix-term/Cargo.toml+1−1
@@ -3,7 +3,7 @@ name = "helix-term"
33version = "0.4.1"
44description = "A post-modern text editor."
55authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
6−edition = "2018"
6+edition = "2021"
77license = "MPL-2.0"
88categories = ["editor", "command-line-utilities"]
99repository = "https://github.com/helix-editor/helix"
helix-term/src/ui/menu.rs+15−17
@@ -64,25 +64,23 @@ impl<T: Item> Menu<T> {
6464 }
6565
6666 pub fn score(&mut self, pattern: &str) {
67− // need to borrow via pattern match otherwise it complains about simultaneous borrow
68− let Self {
69− ref mut matcher,
70− ref mut matches,
71− ref options,
72− ..
73− } = *self;
74−
7567 // reuse the matches allocation
76− matches.clear();
77− matches.extend(options.iter().enumerate().filter_map(|(index, option)| {
78− let text = option.filter_text();
79− // TODO: using fuzzy_indices could give us the char idx for match highlighting
80− matcher
81− .fuzzy_match(text, pattern)
82− .map(|score| (index, score))
83− }));
68+ self.matches.clear();
69+ self.matches.extend(
70+ self.options
71+ .iter()
72+ .enumerate()
73+ .filter_map(|(index, option)| {
74+ let text = option.filter_text();
75+ // TODO: using fuzzy_indices could give us the char idx for match highlighting
76+ self.matcher
77+ .fuzzy_match(text, pattern)
78+ .map(|score| (index, score))
79+ }),
80+ );
8481 // matches.sort_unstable_by_key(|(_, score)| -score);
85− matches.sort_unstable_by_key(|(index, _score)| options[*index].sort_text());
82+ self.matches
83+ .sort_unstable_by_key(|(index, _score)| self.options[*index].sort_text());
8684
8785 // reset cursor position
8886 self.cursor = None;
helix-term/src/ui/picker.rs+7−16
@@ -233,37 +233,28 @@ impl<T> Picker<T> {
233233 }
234234
235235 pub fn score(&mut self) {
236− // need to borrow via pattern match otherwise it complains about simultaneous borrow
237− let Self {
238− ref mut matcher,
239− ref mut matches,
240− ref filters,
241− ref format_fn,
242− ..
243− } = *self;
244−
245236 let pattern = &self.prompt.line;
246237
247238 // reuse the matches allocation
248− matches.clear();
249− matches.extend(
239+ self.matches.clear();
240+ self.matches.extend(
250241 self.options
251242 .iter()
252243 .enumerate()
253244 .filter_map(|(index, option)| {
254245 // filter options first before matching
255− if !filters.is_empty() {
256− filters.binary_search(&index).ok()?;
246+ if !self.filters.is_empty() {
247+ self.filters.binary_search(&index).ok()?;
257248 }
258249 // TODO: maybe using format_fn isn't the best idea here
259− let text = (format_fn)(option);
250+ let text = (self.format_fn)(option);
260251 // TODO: using fuzzy_indices could give us the char idx for match highlighting
261− matcher
252+ self.matcher
262253 .fuzzy_match(&text, pattern)
263254 .map(|score| (index, score))
264255 }),
265256 );
266− matches.sort_unstable_by_key(|(_, score)| -score);
257+ self.matches.sort_unstable_by_key(|(_, score)| -score);
267258
268259 // reset cursor position
269260 self.cursor = 0;
helix-tui/Cargo.toml+1−1
@@ -5,7 +5,7 @@ authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
55description = """
66A library to build rich terminal user interfaces or dashboards
77"""
8−edition = "2018"
8+edition = "2021"
99license = "MPL-2.0"
1010categories = ["editor"]
1111repository = "https://github.com/helix-editor/helix"
helix-view/Cargo.toml+1−1
@@ -2,7 +2,7 @@
22name = "helix-view"
33version = "0.4.1"
44authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
5−edition = "2018"
5+edition = "2021"
66license = "MPL-2.0"
77description = "UI abstractions for use in backends"
88categories = ["editor"]
helix-view/src/theme.rs−1
@@ -1,6 +1,5 @@
11use std::{
22 collections::HashMap,
3− convert::TryFrom,
43 path::{Path, PathBuf},
54};
65