Remove more unreachable pubs

This commit is contained in:
Aleksey Kladov
2020-11-02 16:31:38 +01:00
parent 731b38fa3c
commit ba8d6d1e4e
39 changed files with 114 additions and 121 deletions

View File

@@ -81,7 +81,7 @@ mod tracing_setup {
use tracing_subscriber::Registry;
use tracing_tree::HierarchicalLayer;
pub fn setup_tracing() -> super::Result<()> {
pub(crate) fn setup_tracing() -> super::Result<()> {
let filter = EnvFilter::from_env("CHALK_DEBUG");
let layer = HierarchicalLayer::default()
.with_indent_lines(true)

View File

@@ -4,7 +4,7 @@
use std::io::Write;
/// A Simple ASCII Progress Bar
pub struct ProgressReport {
pub(crate) struct ProgressReport {
curr: f32,
text: String,
hidden: bool,
@@ -15,7 +15,7 @@ pub struct ProgressReport {
}
impl ProgressReport {
pub fn new(len: u64) -> ProgressReport {
pub(crate) fn new(len: u64) -> ProgressReport {
ProgressReport {
curr: 0.0,
text: String::new(),
@@ -26,7 +26,7 @@ impl ProgressReport {
}
}
pub fn hidden() -> ProgressReport {
pub(crate) fn hidden() -> ProgressReport {
ProgressReport {
curr: 0.0,
text: String::new(),
@@ -37,18 +37,18 @@ impl ProgressReport {
}
}
pub fn set_message(&mut self, msg: &str) {
pub(crate) fn set_message(&mut self, msg: &str) {
self.msg = msg.to_string();
self.tick();
}
pub fn println<I: Into<String>>(&mut self, msg: I) {
pub(crate) fn println<I: Into<String>>(&mut self, msg: I) {
self.clear();
println!("{}", msg.into());
self.tick();
}
pub fn inc(&mut self, delta: u64) {
pub(crate) fn inc(&mut self, delta: u64) {
self.pos += delta;
if self.len == 0 {
self.set_value(0.0)
@@ -58,11 +58,11 @@ impl ProgressReport {
self.tick();
}
pub fn finish_and_clear(&mut self) {
pub(crate) fn finish_and_clear(&mut self) {
self.clear();
}
pub fn tick(&mut self) {
pub(crate) fn tick(&mut self) {
if self.hidden {
return;
}

View File

@@ -6,11 +6,11 @@
/// client notifications.
#[derive(Debug, Clone)]
pub(crate) struct DocumentData {
pub version: Option<i64>,
pub(crate) version: Option<i64>,
}
impl DocumentData {
pub fn new(version: i64) -> Self {
pub(crate) fn new(version: i64) -> Self {
DocumentData { version: Some(version) }
}
}

View File

@@ -87,7 +87,7 @@ pub(crate) struct GlobalStateSnapshot {
pub(crate) check_fixes: CheckFixes,
pub(crate) latest_requests: Arc<RwLock<LatestRequests>>,
mem_docs: FxHashMap<VfsPath, DocumentData>,
pub semantic_tokens_cache: Arc<Mutex<FxHashMap<Url, SemanticTokens>>>,
pub(crate) semantic_tokens_cache: Arc<Mutex<FxHashMap<Url, SemanticTokens>>>,
vfs: Arc<RwLock<(vfs::Vfs, FxHashMap<FileId, LineEndings>)>>,
pub(crate) workspaces: Arc<Vec<ProjectWorkspace>>,
}

View File

@@ -101,12 +101,12 @@ pub(crate) struct SemanticTokensBuilder {
}
impl SemanticTokensBuilder {
pub fn new(id: String) -> Self {
pub(crate) fn new(id: String) -> Self {
SemanticTokensBuilder { id, prev_line: 0, prev_char: 0, data: Default::default() }
}
/// Push a new token onto the builder
pub fn push(&mut self, range: Range, token_index: u32, modifier_bitset: u32) {
pub(crate) fn push(&mut self, range: Range, token_index: u32, modifier_bitset: u32) {
let mut push_line = range.start.line as u32;
let mut push_char = range.start.character as u32;
@@ -134,12 +134,12 @@ impl SemanticTokensBuilder {
self.prev_char = range.start.character as u32;
}
pub fn build(self) -> SemanticTokens {
pub(crate) fn build(self) -> SemanticTokens {
SemanticTokens { result_id: Some(self.id), data: self.data }
}
}
pub fn diff_tokens(old: &[SemanticToken], new: &[SemanticToken]) -> Vec<SemanticTokensEdit> {
pub(crate) fn diff_tokens(old: &[SemanticToken], new: &[SemanticToken]) -> Vec<SemanticTokensEdit> {
let offset = new.iter().zip(old.iter()).take_while(|&(n, p)| n == p).count();
let (_, old) = old.split_at(offset);
@@ -165,7 +165,7 @@ pub fn diff_tokens(old: &[SemanticToken], new: &[SemanticToken]) -> Vec<Semantic
}
}
pub fn type_index(type_: SemanticTokenType) -> u32 {
pub(crate) fn type_index(type_: SemanticTokenType) -> u32 {
SUPPORTED_TYPES.iter().position(|it| *it == type_).unwrap() as u32
}