aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
authorIvan Tham2021-06-07 14:34:19 +0000
committerBlaž Hrastnik2021-06-10 13:00:08 +0000
commit7cc13fefe9bd09ea778a0eb8c26bf133e6ad2476 (patch)
tree764c662e47f12134a8a7f20211573243100777a5 /helix-core/src
parent1a3a92463405fdd4738fbdbfda212aef58a2919d (diff)
Derive debug without feature
Note that this also removed those `finish_non_exhaustive()`.
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/diagnostic.rs7
-rw-r--r--helix-core/src/graphemes.rs3
-rw-r--r--helix-core/src/history.rs2
-rw-r--r--helix-core/src/movement.rs3
-rw-r--r--helix-core/src/state.rs3
-rw-r--r--helix-core/src/syntax.rs34
-rw-r--r--helix-core/src/transaction.rs3
7 files changed, 21 insertions, 34 deletions
diff --git a/helix-core/src/diagnostic.rs b/helix-core/src/diagnostic.rs
index 0ab7b645..e08a71e7 100644
--- a/helix-core/src/diagnostic.rs
+++ b/helix-core/src/diagnostic.rs
@@ -1,5 +1,4 @@
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Eq, PartialEq)]
+#[derive(Debug, Eq, PartialEq)]
pub enum Severity {
Error,
Warning,
@@ -7,13 +6,13 @@ pub enum Severity {
Hint,
}
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct Range {
pub start: usize,
pub end: usize,
}
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct Diagnostic {
pub range: Range,
pub line: usize,
diff --git a/helix-core/src/graphemes.rs b/helix-core/src/graphemes.rs
index c68b0ee5..9844a343 100644
--- a/helix-core/src/graphemes.rs
+++ b/helix-core/src/graphemes.rs
@@ -147,8 +147,7 @@ pub fn is_grapheme_boundary(slice: RopeSlice, char_idx: usize) -> bool {
}
/// An iterator over the graphemes of a `RopeSlice`.
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Clone)]
+#[derive(Debug, Clone)]
pub struct RopeGraphemes<'a> {
text: RopeSlice<'a>,
chunks: Chunks<'a>,
diff --git a/helix-core/src/history.rs b/helix-core/src/history.rs
index 6eb72cea..aa3bf193 100644
--- a/helix-core/src/history.rs
+++ b/helix-core/src/history.rs
@@ -2,7 +2,7 @@ use crate::{ChangeSet, Rope, State, Transaction};
use smallvec::{smallvec, SmallVec};
/// Undo-tree style history store.
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct History {
revisions: Vec<Revision>,
cursor: usize,
diff --git a/helix-core/src/movement.rs b/helix-core/src/movement.rs
index 8a30e4c6..32dfcae3 100644
--- a/helix-core/src/movement.rs
+++ b/helix-core/src/movement.rs
@@ -1,8 +1,7 @@
use crate::graphemes::{nth_next_grapheme_boundary, nth_prev_grapheme_boundary, RopeGraphemes};
use crate::{coords_at_pos, pos_at_coords, ChangeSet, Position, Range, Rope, RopeSlice, Selection};
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Copy, Clone, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Direction {
Forward,
Backward,
diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs
index c8a0cf8b..7e4a7f70 100644
--- a/helix-core/src/state.rs
+++ b/helix-core/src/state.rs
@@ -1,8 +1,7 @@
use crate::{Rope, Selection};
/// A state represents the current editor state of a single buffer.
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Clone)]
+#[derive(Debug, Clone)]
pub struct State {
pub doc: Rope,
pub selection: Selection,
diff --git a/helix-core/src/syntax.rs b/helix-core/src/syntax.rs
index ca20ff1a..ec21719b 100644
--- a/helix-core/src/syntax.rs
+++ b/helix-core/src/syntax.rs
@@ -1,12 +1,11 @@
use crate::{regex::Regex, Change, Rope, RopeSlice, Transaction};
pub use helix_syntax::{get_language, get_language_name, Lang};
-#[cfg(feature = "debug")]
-use std::fmt;
use std::{
borrow::Cow,
cell::RefCell,
collections::{HashMap, HashSet},
+ fmt,
path::{Path, PathBuf},
sync::Arc,
};
@@ -14,15 +13,13 @@ use std::{
use once_cell::sync::{Lazy, OnceCell};
use serde::{Deserialize, Serialize};
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize)]
pub struct Configuration {
pub language: Vec<LanguageConfiguration>,
}
// largely based on tree-sitter/cli/src/loader.rs
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct LanguageConfiguration {
#[serde(rename = "name")]
@@ -50,8 +47,7 @@ pub struct LanguageConfiguration {
pub(crate) indent_query: OnceCell<Option<IndentQuery>>,
}
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct LanguageServerConfiguration {
pub command: String,
@@ -60,16 +56,14 @@ pub struct LanguageServerConfiguration {
pub args: Vec<String>,
}
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct IndentationConfiguration {
pub tab_width: usize,
pub unit: String,
}
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Serialize, Deserialize)]
+#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub struct IndentQuery {
#[serde(default)]
@@ -196,7 +190,7 @@ impl LanguageConfiguration {
pub static LOADER: OnceCell<Loader> = OnceCell::new();
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct Loader {
// highlight_names ?
language_configs: Vec<Arc<LanguageConfiguration>>,
@@ -264,10 +258,9 @@ pub struct TsParser {
cursors: Vec<QueryCursor>,
}
-#[cfg(feature = "debug")]
impl fmt::Debug for TsParser {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_struct("TsParser").finish_non_exhaustive()
+ f.debug_struct("TsParser").finish()
}
}
@@ -279,7 +272,7 @@ thread_local! {
})
}
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct Syntax {
config: Arc<HighlightConfiguration>,
@@ -460,7 +453,7 @@ impl Syntax {
// buffer_range_for_scope_at_pos
}
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct LanguageLayer {
// mode
// grammar
@@ -769,7 +762,7 @@ pub enum HighlightEvent {
/// Contains the data neeeded to higlight code written in a particular language.
///
/// This struct is immutable and can be shared between threads.
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
pub struct HighlightConfiguration {
pub language: Grammar,
pub query: Query,
@@ -800,7 +793,7 @@ struct LocalScope<'a> {
local_defs: Vec<LocalDef<'a>>,
}
-#[cfg_attr(feature = "debug", derive(Debug))]
+#[derive(Debug)]
struct HighlightIter<'a, 'tree: 'a, F>
where
F: FnMut(&str) -> Option<&'a HighlightConfiguration> + 'a,
@@ -826,10 +819,9 @@ struct HighlightIterLayer<'a, 'tree: 'a> {
depth: usize,
}
-#[cfg(feature = "debug")]
impl<'a, 'tree: 'a> fmt::Debug for HighlightIterLayer<'a, 'tree> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
- f.debug_struct("HighlightIterLayer").finish_non_exhaustive()
+ f.debug_struct("HighlightIterLayer").finish()
}
}
diff --git a/helix-core/src/transaction.rs b/helix-core/src/transaction.rs
index 24abe0ab..49ac396d 100644
--- a/helix-core/src/transaction.rs
+++ b/helix-core/src/transaction.rs
@@ -15,8 +15,7 @@ pub enum Operation {
Insert(Tendril),
}
-#[cfg_attr(feature = "debug", derive(Debug))]
-#[derive(Copy, Clone, PartialEq, Eq)]
+#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub enum Assoc {
Before,
After,