Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 7 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![allow(unknown_lints)]
#![deny(dead_code_pub_in_binary, unreachable_pub)]

use heck::ToUpperCamelCase;
use indexmap::IndexMap;
use serde::Serialize as _;
Expand Down Expand Up @@ -615,7 +618,7 @@ fn codegen_settings() {
let mut lines = vec![
r#"#[derive(Config, Default, Debug, Clone, Serialize)]
#[config(layer_attr(derive(Clone, Serialize, Default)))]
pub struct Settings {"#
pub(crate) struct Settings {"#
.to_string(),
];

Expand Down Expand Up @@ -729,7 +732,7 @@ pub struct Settings {"#
#[derive(Config, Default, Debug, Clone, Serialize)]
#[config(layer_attr(derive(Clone, Serialize, Default)))]
#[config(layer_attr(serde(deny_unknown_fields)))]
pub struct {name} {{"#,
pub(crate) struct {name} {{"#,
name = settings_struct_name(&path)
));

Expand All @@ -744,7 +747,7 @@ pub struct {name} {{"#,

lines.push(
r#"
pub static SETTINGS_META: Lazy<IndexMap<&'static str, SettingsMeta>> = Lazy::new(|| {
pub(crate) static SETTINGS_META: Lazy<IndexMap<&'static str, SettingsMeta>> = Lazy::new(|| {
indexmap!{"#
.to_string(),
);
Expand Down Expand Up @@ -836,7 +839,7 @@ pub static SETTINGS_META: Lazy<IndexMap<&'static str, SettingsMeta>> = Lazy::new
/// These settings affect config file discovery and must be loaded before
/// the main config files are parsed.
#[derive(Debug, Clone, Default, serde::Deserialize)]
pub struct MisercSettings {"#
pub(crate) struct MisercSettings {"#
.to_string(),
);

Expand Down
1 change: 1 addition & 0 deletions crates/aqua-registry/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// eyre 0.6.12 emits a trailing semicolon from bail!, which nightly rejects.
#![deny(unreachable_pub)]
#![allow(semicolon_in_expressions_from_macros)]

//! Aqua Registry
Expand Down
2 changes: 1 addition & 1 deletion crates/aqua-registry/src/template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ impl Value for SemVerValue {
}
}

pub fn render(tmpl: &str, ctx: &Context) -> Result<String> {
pub(crate) fn render(tmpl: &str, ctx: &Context) -> Result<String> {
let mut result = String::new();
let mut in_tag = false;
let mut tag = String::new();
Expand Down
2 changes: 2 additions & 0 deletions crates/mise-cache-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(unreachable_pub)]

use base64::{Engine as _, engine::general_purpose::URL_SAFE_NO_PAD};
use eyre::{Result, bail, eyre};
use futures_util::TryStreamExt as _;
Expand Down
2 changes: 2 additions & 0 deletions crates/mise-cache-rustc/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![deny(unreachable_pub)]

use mise_cache_core::{CacheDigest, canonical_json};
use serde::{Deserialize, Serialize};
use std::collections::{BTreeMap, BTreeSet};
Expand Down
3 changes: 3 additions & 0 deletions crates/mise-interactive-config/build.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#![allow(unknown_lints)]
#![deny(dead_code_pub_in_binary, unreachable_pub)]

//! Build script to generate schema data from mise.json

use serde_json::Value;
Expand Down
30 changes: 15 additions & 15 deletions crates/mise-interactive-config/src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use crate::document::{EntryValue, TomlDocument};

/// Cursor position in the document
#[derive(Debug, Clone)]
pub struct Cursor {
pub(crate) struct Cursor {
/// Flat index into visible items
index: usize,
}

/// What the cursor is currently pointing at
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum CursorTarget {
pub(crate) enum CursorTarget {
/// Section header (section index)
SectionHeader(usize),
/// Entry within a section (section index, entry index)
Expand All @@ -28,7 +28,7 @@ pub enum CursorTarget {

/// Types of add buttons
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum AddButtonKind {
pub(crate) enum AddButtonKind {
/// Add a new section
Section,
/// Add an entry to a section (section index) - generic
Expand Down Expand Up @@ -65,23 +65,23 @@ pub enum AddButtonKind {

impl Cursor {
/// Create a new cursor at the beginning
pub fn new() -> Self {
pub(crate) fn new() -> Self {
Self { index: 0 }
}

/// Get the current index
pub fn index(&self) -> usize {
pub(crate) fn index(&self) -> usize {
self.index
}

/// Set the index directly
#[allow(dead_code)]
pub fn set_index(&mut self, index: usize) {
pub(crate) fn set_index(&mut self, index: usize) {
self.index = index;
}

/// Move cursor up, skipping comments
pub fn up(&mut self, doc: &TomlDocument) {
pub(crate) fn up(&mut self, doc: &TomlDocument) {
let items = Self::build_visible_items(doc);
let max = items.len();
if max == 0 {
Expand Down Expand Up @@ -109,7 +109,7 @@ impl Cursor {
}

/// Move cursor down, skipping comments
pub fn down(&mut self, doc: &TomlDocument) {
pub(crate) fn down(&mut self, doc: &TomlDocument) {
let items = Self::build_visible_items(doc);
let max = items.len();
if max == 0 {
Expand Down Expand Up @@ -137,7 +137,7 @@ impl Cursor {
}

/// Jump to next section header
pub fn next_section(&mut self, doc: &TomlDocument) {
pub(crate) fn next_section(&mut self, doc: &TomlDocument) {
let items = Self::build_visible_items(doc);
let current = self.index;

Expand All @@ -159,7 +159,7 @@ impl Cursor {
}

/// Jump to previous section header
pub fn prev_section(&mut self, doc: &TomlDocument) {
pub(crate) fn prev_section(&mut self, doc: &TomlDocument) {
let items = Self::build_visible_items(doc);
let current = self.index;

Expand All @@ -181,13 +181,13 @@ impl Cursor {
}

/// Get what the cursor is currently pointing at
pub fn target(&self, doc: &TomlDocument) -> Option<CursorTarget> {
pub(crate) fn target(&self, doc: &TomlDocument) -> Option<CursorTarget> {
let items = Self::build_visible_items(doc);
items.get(self.index).cloned()
}

/// Ensure cursor is within valid bounds and not on a comment
pub fn clamp(&mut self, doc: &TomlDocument) {
pub(crate) fn clamp(&mut self, doc: &TomlDocument) {
let items = Self::build_visible_items(doc);
let max = items.len();
if max == 0 {
Expand All @@ -211,7 +211,7 @@ impl Cursor {
}

/// Build list of all visible items (for navigation)
pub fn build_visible_items(doc: &TomlDocument) -> Vec<CursorTarget> {
pub(crate) fn build_visible_items(doc: &TomlDocument) -> Vec<CursorTarget> {
let mut items = Vec::new();

for (section_idx, section) in doc.sections.iter().enumerate() {
Expand Down Expand Up @@ -332,13 +332,13 @@ impl Cursor {
}

/// Find index for a specific target
pub fn find_index(doc: &TomlDocument, target: &CursorTarget) -> Option<usize> {
pub(crate) fn find_index(doc: &TomlDocument, target: &CursorTarget) -> Option<usize> {
let items = Self::build_visible_items(doc);
items.iter().position(|t| t == target)
}

/// Move cursor to a specific target if it exists
pub fn goto(&mut self, doc: &TomlDocument, target: &CursorTarget) {
pub(crate) fn goto(&mut self, doc: &TomlDocument, target: &CursorTarget) {
if let Some(idx) = Self::find_index(doc, target) {
self.index = idx;
}
Expand Down
Loading
Loading