Update to rust 1.56 + 2021 edition
This commit is contained in:
parent
3b032e8e1f
commit
182a59b552
11 changed files with 82 additions and 56 deletions
68
flake.lock
generated
68
flake.lock
generated
|
@ -2,11 +2,11 @@
|
|||
"nodes": {
|
||||
"devshell": {
|
||||
"locked": {
|
||||
"lastModified": 1630239564,
|
||||
"narHash": "sha256-lv7atkVE1+dFw0llmzONsbSIo5ao85KpNSRoFk4K8vU=",
|
||||
"lastModified": 1632436039,
|
||||
"narHash": "sha256-OtITeVWcKXn1SpVEnImpTGH91FycCskGBPqmlxiykv4=",
|
||||
"owner": "numtide",
|
||||
"repo": "devshell",
|
||||
"rev": "bd86d3a2bb28ce4d223315e0eca0d59fef8a0a73",
|
||||
"rev": "7a7a7aa0adebe5488e5abaec688fd9ae0f8ea9c6",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -15,6 +15,21 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1623875721,
|
||||
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flakeCompat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
@ -37,14 +52,16 @@
|
|||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"rustOverlay": "rustOverlay"
|
||||
"rustOverlay": [
|
||||
"rust-overlay"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1631254163,
|
||||
"narHash": "sha256-8+nOGLH1fXwWnNMTQq/Igk434BzZF5Vld45xLDLiNDQ=",
|
||||
"lastModified": 1634796585,
|
||||
"narHash": "sha256-CW4yx6omk5qCXUIwXHp/sztA7u0SpyLq9NEACPnkiz8=",
|
||||
"owner": "yusdacra",
|
||||
"repo": "nix-cargo-integration",
|
||||
"rev": "432d8504a32232e8d74710024d5bf5cc31767651",
|
||||
"rev": "a84a2137a396f303978f1d48341e0390b0e16a8b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -55,11 +72,11 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1631206977,
|
||||
"narHash": "sha256-o3Dct9aJ5ht5UaTUBzXrRcK1RZt2eG5/xSlWJuUCVZM=",
|
||||
"lastModified": 1634782485,
|
||||
"narHash": "sha256-psfh4OQSokGXG0lpq3zKFbhOo3QfoeudRcaUnwMRkQo=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4f6d8095fd51954120a1d08ea5896fe42dc3923b",
|
||||
"rev": "34ad3ffe08adfca17fcb4e4a47bb5f3b113687be",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
@ -69,21 +86,40 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1628186154,
|
||||
"narHash": "sha256-r2d0wvywFnL9z4iptztdFMhaUIAaGzrSs7kSok0PgmE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "06552b72346632b6943c8032e57e702ea12413bf",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flakeCompat": "flakeCompat",
|
||||
"nixCargoIntegration": "nixCargoIntegration",
|
||||
"nixpkgs": "nixpkgs"
|
||||
"nixpkgs": "nixpkgs",
|
||||
"rust-overlay": "rust-overlay"
|
||||
}
|
||||
},
|
||||
"rustOverlay": {
|
||||
"flake": false,
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1631240108,
|
||||
"narHash": "sha256-ffsTkAGyQLxu4E28nVcqwc8xFL/H1UEwrRw2ITI43Aw=",
|
||||
"lastModified": 1634869268,
|
||||
"narHash": "sha256-RVAcEFlFU3877Mm4q/nbXGEYTDg/wQNhzmXGMTV6wBs=",
|
||||
"owner": "oxalica",
|
||||
"repo": "rust-overlay",
|
||||
"rev": "3a29d5e726b855d9463eb5dfe04f1ec14d413289",
|
||||
"rev": "c02c2d86354327317546501af001886fbb53d374",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||
nixCargoIntegration = {
|
||||
url = "github:yusdacra/nix-cargo-integration";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.rustOverlay.follows = "rust-overlay";
|
||||
};
|
||||
flakeCompat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
name = "helix-core"
|
||||
version = "0.4.1"
|
||||
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
license = "MPL-2.0"
|
||||
description = "Helix editor core editing primitives"
|
||||
categories = ["editor"]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
name = "helix-lsp"
|
||||
version = "0.4.1"
|
||||
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
license = "MPL-2.0"
|
||||
description = "LSP client implementation for Helix project"
|
||||
categories = ["editor"]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
name = "helix-syntax"
|
||||
version = "0.4.1"
|
||||
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
license = "MPL-2.0"
|
||||
description = "Tree-sitter grammars support"
|
||||
categories = ["editor"]
|
||||
|
|
|
@ -3,7 +3,7 @@ name = "helix-term"
|
|||
version = "0.4.1"
|
||||
description = "A post-modern text editor."
|
||||
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
license = "MPL-2.0"
|
||||
categories = ["editor", "command-line-utilities"]
|
||||
repository = "https://github.com/helix-editor/helix"
|
||||
|
|
|
@ -64,25 +64,23 @@ impl<T: Item> Menu<T> {
|
|||
}
|
||||
|
||||
pub fn score(&mut self, pattern: &str) {
|
||||
// need to borrow via pattern match otherwise it complains about simultaneous borrow
|
||||
let Self {
|
||||
ref mut matcher,
|
||||
ref mut matches,
|
||||
ref options,
|
||||
..
|
||||
} = *self;
|
||||
|
||||
// reuse the matches allocation
|
||||
matches.clear();
|
||||
matches.extend(options.iter().enumerate().filter_map(|(index, option)| {
|
||||
let text = option.filter_text();
|
||||
// TODO: using fuzzy_indices could give us the char idx for match highlighting
|
||||
matcher
|
||||
.fuzzy_match(text, pattern)
|
||||
.map(|score| (index, score))
|
||||
}));
|
||||
self.matches.clear();
|
||||
self.matches.extend(
|
||||
self.options
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(index, option)| {
|
||||
let text = option.filter_text();
|
||||
// TODO: using fuzzy_indices could give us the char idx for match highlighting
|
||||
self.matcher
|
||||
.fuzzy_match(text, pattern)
|
||||
.map(|score| (index, score))
|
||||
}),
|
||||
);
|
||||
// matches.sort_unstable_by_key(|(_, score)| -score);
|
||||
matches.sort_unstable_by_key(|(index, _score)| options[*index].sort_text());
|
||||
self.matches
|
||||
.sort_unstable_by_key(|(index, _score)| self.options[*index].sort_text());
|
||||
|
||||
// reset cursor position
|
||||
self.cursor = None;
|
||||
|
|
|
@ -233,37 +233,28 @@ impl<T> Picker<T> {
|
|||
}
|
||||
|
||||
pub fn score(&mut self) {
|
||||
// need to borrow via pattern match otherwise it complains about simultaneous borrow
|
||||
let Self {
|
||||
ref mut matcher,
|
||||
ref mut matches,
|
||||
ref filters,
|
||||
ref format_fn,
|
||||
..
|
||||
} = *self;
|
||||
|
||||
let pattern = &self.prompt.line;
|
||||
|
||||
// reuse the matches allocation
|
||||
matches.clear();
|
||||
matches.extend(
|
||||
self.matches.clear();
|
||||
self.matches.extend(
|
||||
self.options
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter_map(|(index, option)| {
|
||||
// filter options first before matching
|
||||
if !filters.is_empty() {
|
||||
filters.binary_search(&index).ok()?;
|
||||
if !self.filters.is_empty() {
|
||||
self.filters.binary_search(&index).ok()?;
|
||||
}
|
||||
// TODO: maybe using format_fn isn't the best idea here
|
||||
let text = (format_fn)(option);
|
||||
let text = (self.format_fn)(option);
|
||||
// TODO: using fuzzy_indices could give us the char idx for match highlighting
|
||||
matcher
|
||||
self.matcher
|
||||
.fuzzy_match(&text, pattern)
|
||||
.map(|score| (index, score))
|
||||
}),
|
||||
);
|
||||
matches.sort_unstable_by_key(|(_, score)| -score);
|
||||
self.matches.sort_unstable_by_key(|(_, score)| -score);
|
||||
|
||||
// reset cursor position
|
||||
self.cursor = 0;
|
||||
|
|
|
@ -5,7 +5,7 @@ authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
|||
description = """
|
||||
A library to build rich terminal user interfaces or dashboards
|
||||
"""
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
license = "MPL-2.0"
|
||||
categories = ["editor"]
|
||||
repository = "https://github.com/helix-editor/helix"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
name = "helix-view"
|
||||
version = "0.4.1"
|
||||
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
||||
edition = "2018"
|
||||
edition = "2021"
|
||||
license = "MPL-2.0"
|
||||
description = "UI abstractions for use in backends"
|
||||
categories = ["editor"]
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use std::{
|
||||
collections::HashMap,
|
||||
convert::TryFrom,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue