no-mistakes(lint): fix(lint): rustfmt formatting in mods.rs

This commit is contained in:
objz committed 2026-04-25 14:25:04 +02:00
1 parent 9f463c80bc
commit 5dbb2be873
50 files changed
+624 -351

No files matched your search

+1 -1
View File
@@ -2,4 +2,4 @@ mod render;
mod state;
pub use render::{popup_rect, render};
pub use state::{handle_key, take_result, ImportResult, ImportStep, ImportWizardState};
pub use state::{ImportResult, ImportStep, ImportWizardState, handle_key, take_result};
+10 -27
View File
@@ -3,15 +3,15 @@
use super::super::base::PopupFrame;
use super::super::new_instance::LoadState;
use super::state::{ImportStep, ImportWizardState, IMPORT_STATE};
use crate::tui::app::FocusedArea;
use super::state::{IMPORT_STATE, ImportStep, ImportWizardState};
use crate::config::theme::THEME;
use crate::tui::app::FocusedArea;
use ratatui::{
Frame,
layout::{Constraint, Direction, Layout, Rect},
style::{Modifier, Style},
text::{Line, Span},
widgets::{List, ListItem, ListState, Paragraph, StatefulWidget, Widget, Wrap},
Frame,
};
pub fn render(frame: &mut Frame, area: Rect, _focused: FocusedArea) {
@@ -85,11 +85,7 @@ pub fn popup_rect(frame_area: Rect) -> Rect {
}
}
fn render_input_step(
state: &ImportWizardState,
area: Rect,
buf: &mut ratatui::buffer::Buffer,
) {
fn render_input_step(state: &ImportWizardState, area: Rect, buf: &mut ratatui::buffer::Buffer) {
let theme = THEME.as_ref();
let chunks = Layout::default()
.direction(Direction::Vertical)
@@ -115,10 +111,7 @@ fn render_input_step(
])
} else {
Line::from(vec![
Span::styled(
state.input.clone(),
Style::default().fg(theme.text()),
),
Span::styled(state.input.clone(), Style::default().fg(theme.text())),
Span::styled(
"\u{2588}",
Style::default()
@@ -137,11 +130,7 @@ fn render_fetching_step(area: Rect, buf: &mut ratatui::buffer::Buffer) {
.render(area, buf);
}
fn render_version_step(
state: &ImportWizardState,
area: Rect,
buf: &mut ratatui::buffer::Buffer,
) {
fn render_version_step(state: &ImportWizardState, area: Rect, buf: &mut ratatui::buffer::Buffer) {
let theme = THEME.as_ref();
match &state.versions {
LoadState::Idle | LoadState::Loading => {
@@ -182,11 +171,7 @@ fn render_version_step(
}
}
fn render_confirm_step(
state: &ImportWizardState,
area: Rect,
buf: &mut ratatui::buffer::Buffer,
) {
fn render_confirm_step(state: &ImportWizardState, area: Rect, buf: &mut ratatui::buffer::Buffer) {
let theme = THEME.as_ref();
let summary = match &state.summary {
Some(s) => s,
@@ -247,11 +232,9 @@ fn step_keybinds(state: &ImportWizardState) -> Line<'static> {
match state.step {
ImportStep::Input => keybind_line(&[("Enter", " fetch")]),
ImportStep::Fetching => keybind_line(&[("Esc", " cancel")]),
ImportStep::Version => keybind_line(&[
("/", " search"),
("h", " back"),
("Enter", " select"),
]),
ImportStep::Version => {
keybind_line(&[("/", " search"), ("h", " back"), ("Enter", " select")])
}
ImportStep::Confirm => keybind_line(&[("h", " back"), ("Enter", " import")]),
}
}
+23 -27
View File
@@ -4,7 +4,7 @@
// local files skip straight to the confirm step.
use super::super::new_instance::LoadState;
use crate::instance::import::{parse_import_input, ImportInput, ImportSummary};
use crate::instance::import::{ImportInput, ImportSummary, parse_import_input};
use crate::net::modrinth::{self, VersionInfo};
use crate::tui::widgets::instances;
use crate::tui::widgets::search::SearchState;
@@ -309,21 +309,19 @@ async fn resolve_version_id(
}
match modrinth::download_mrpack(client, &version, &tmp_dir).await {
Ok(mrpack_path) => {
match crate::instance::import::build_summary(&mrpack_path) {
Ok(summary) => {
if let Ok(mut s) = state_arc.lock() {
s.summary = Some(summary);
s.step = ImportStep::Confirm;
}
Ok(mrpack_path) => match crate::instance::import::build_summary(&mrpack_path) {
Ok(summary) => {
if let Ok(mut s) = state_arc.lock() {
s.summary = Some(summary);
s.step = ImportStep::Confirm;
}
Err(e) => set_error_and_back(
&state_arc,
format!("Failed to build summary: {}", e),
ImportStep::Input,
),
}
}
Err(e) => set_error_and_back(
&state_arc,
format!("Failed to build summary: {}", e),
ImportStep::Input,
),
},
Err(e) => set_error_and_back(
&state_arc,
format!("Failed to download mrpack: {}", e),
@@ -383,21 +381,19 @@ fn start_version_download(state: &mut ImportWizardState) {
}
match modrinth::download_mrpack(&client, &version, &tmp_dir).await {
Ok(mrpack_path) => {
match crate::instance::import::build_summary(&mrpack_path) {
Ok(summary) => {
if let Ok(mut s) = state_arc.lock() {
s.summary = Some(summary);
s.step = ImportStep::Confirm;
}
Ok(mrpack_path) => match crate::instance::import::build_summary(&mrpack_path) {
Ok(summary) => {
if let Ok(mut s) = state_arc.lock() {
s.summary = Some(summary);
s.step = ImportStep::Confirm;
}
Err(e) => set_error_and_back(
&state_arc,
format!("Failed to build summary: {}", e),
ImportStep::Version,
),
}
}
Err(e) => set_error_and_back(
&state_arc,
format!("Failed to build summary: {}", e),
ImportStep::Version,
),
},
Err(e) => set_error_and_back(
&state_arc,
format!("Failed to download mrpack: {}", e),