aboutsummaryrefslogtreecommitdiff
path: root/mingling_cli/src/linter/cmd_mlint_install.rs
diff options
context:
space:
mode:
Diffstat (limited to 'mingling_cli/src/linter/cmd_mlint_install.rs')
-rw-r--r--mingling_cli/src/linter/cmd_mlint_install.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/mingling_cli/src/linter/cmd_mlint_install.rs b/mingling_cli/src/linter/cmd_mlint_install.rs
index d29d3e5..bad61a7 100644
--- a/mingling_cli/src/linter/cmd_mlint_install.rs
+++ b/mingling_cli/src/linter/cmd_mlint_install.rs
@@ -4,7 +4,7 @@ use crate::linter::mlint_report::{
};
use mingling::Routable;
use mingling::macros::{buffer, chain, dispatcher, pack, r_eprintln, renderer, routeify};
-use mingling::res::ResCurrentDir;
+use mingling::res::{ResCurrentDir, ResExitCode};
use std::ops::Range;
use std::path::PathBuf;
@@ -19,7 +19,6 @@ const VALUE_CHECK_ON_SAVE_TRUE: &str = "true";
const DISPLAY_CHECK_ON_SAVE_TRUE: &str = "checkOnSave = true";
// File names
-const CFG_FILE_NAME: &str = ".rust-analyzer.toml";
const SOURCE_FILE_NAME: &str = "rust-analyzer.toml";
const MSG_ALREADY_CORRECT: &str = "`.rust-analyzer.toml` already has the correct mling settings";
@@ -52,7 +51,7 @@ pack!(ResultMlingLinterConfigInstalled = PathBuf);
#[chain]
pub fn handle_lint_install(_: EntryLintInstall, current_dir: &ResCurrentDir) -> Next {
- let cfg_file_path = current_dir.join(CFG_FILE_NAME);
+ let cfg_file_path = current_dir.join(SOURCE_FILE_NAME);
if !cfg_file_path.exists() {
return StateWriteMlingLinterConfig::new(cfg_file_path).to_chain();
@@ -81,8 +80,11 @@ pub fn render_mling_linter_config_installed(result: ResultMlingLinterConfigInsta
pub fn handle_state_suggest_mling_linter_setup(
_: StateSuggestMlingLinterSetup,
current_dir: &ResCurrentDir,
+ ec: &mut ResExitCode,
) -> StateLintReports {
- let cfg_file_path = current_dir.join(CFG_FILE_NAME);
+ ec.exit_code = 1;
+
+ let cfg_file_path = current_dir.join(SOURCE_FILE_NAME);
let file_name = cfg_file_path.to_string_lossy().to_string();
let content = match std::fs::read_to_string(&cfg_file_path) {