aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorBlaž Hrastnik2020-09-29 09:02:27 +0000
committerBlaž Hrastnik2020-09-29 09:07:05 +0000
commit3feb00283df92b8865c9cf7baba0e2ab06dcc028 (patch)
treec174b36de7866b7710a7f29cca95d9f6be66dcaa /helix-core/src
parent1bb01d27aed8b046ff1cb41d4932c303d3b4ad0d (diff)
clippy warnings
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/state.rs3
-rw-r--r--helix-core/src/syntax.rs14
2 files changed, 8 insertions, 9 deletions
diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs
index ffe88c3f..aa377091 100644
--- a/helix-core/src/state.rs
+++ b/helix-core/src/state.rs
@@ -358,7 +358,7 @@ where
{
let mut chars = slice.chars_at(*pos);
- while let Some(ch) = chars.next() {
+ for ch in chars {
if !fun(ch) {
break;
}
@@ -372,7 +372,6 @@ where
{
// need to +1 so that prev() includes current char
let mut chars = slice.chars_at(*pos + 1);
- let mut chars = slice.chars_at(*pos + 1);
while let Some(ch) = chars.prev() {
if !fun(ch) {
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index 3d85ff25..638ec8ee 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -37,11 +37,11 @@ impl LanguageConfiguration {
let highlights_query =
std::fs::read_to_string(self.path.join("queries/highlights.scm"))
- .unwrap_or(String::new());
+ .unwrap_or_default();
let injections_query =
std::fs::read_to_string(self.path.join("queries/injections.scm"))
- .unwrap_or(String::new());
+ .unwrap_or_default();
let locals_query = "";
@@ -66,7 +66,7 @@ impl LanguageConfiguration {
use once_cell::sync::Lazy;
-pub(crate) static LOADER: Lazy<Loader> = Lazy::new(|| Loader::init());
+pub(crate) static LOADER: Lazy<Loader> = Lazy::new(Loader::init);
pub struct Loader {
// highlight_names ?
@@ -159,7 +159,7 @@ impl Syntax {
// let grammar = get_language(&language);
let parser = Parser::new();
- let root_layer = LanguageLayer::new();
+ let root_layer = LanguageLayer { tree: None };
// track markers of injections
// track scope_descriptor: a Vec of scopes for item in tree
@@ -317,9 +317,9 @@ use crate::transaction::{ChangeSet, Operation};
use crate::Tendril;
impl LanguageLayer {
- pub fn new() -> Self {
- Self { tree: None }
- }
+ // pub fn new() -> Self {
+ // Self { tree: None }
+ // }
fn tree(&self) -> &Tree {
// TODO: no unwrap