Skip to content

Commit c6cc145

Browse files
refactor: remove unused function
1 parent 177ebca commit c6cc145

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

crates/cli/src/config.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -216,11 +216,6 @@ pub fn read_rule_file(
216216
parsed.with_context(|| EC::ParseRule(path.to_path_buf()))
217217
}
218218

219-
/// Returns the base_directory where config is and config object.
220-
pub fn read_config_from_dir<P: AsRef<Path>>(path: P) -> Result<Option<ProjectConfig>> {
221-
ProjectConfig::by_project_dir(path.as_ref())
222-
}
223-
224219
const CONFIG_FILE: &str = "sgconfig.yml";
225220

226221
fn find_config_path_with_default(

crates/cli/src/new.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use crate::config::{
2-
read_config_from_dir, register_custom_language, AstGrepConfig, ProjectConfig, TestConfig,
3-
};
1+
use crate::config::{register_custom_language, AstGrepConfig, ProjectConfig, TestConfig};
42
use crate::lang::SgLang;
53
use crate::utils::ErrorContext as EC;
64

@@ -157,7 +155,7 @@ pub fn run_create_new(mut arg: NewArg) -> Result<()> {
157155

158156
fn run_create_entity(entity: Entity, arg: NewArg) -> Result<()> {
159157
// check if we are under a project dir
160-
if let Some(found) = read_config_from_dir(&arg.base_dir)? {
158+
if let Some(found) = ProjectConfig::by_project_dir(&arg.base_dir)? {
161159
return do_create_entity(entity, found, arg);
162160
}
163161
// check if we creating a project
@@ -181,7 +179,7 @@ fn do_create_entity(entity: Entity, found: ProjectConfig, arg: NewArg) -> Result
181179

182180
fn ask_entity_type(arg: NewArg) -> Result<()> {
183181
// 1. check if we are under a sgconfig.yml
184-
if let Some(found) = read_config_from_dir(&arg.base_dir)? {
182+
if let Some(found) = ProjectConfig::by_project_dir(&arg.base_dir)? {
185183
// 2. ask users what to create if yes
186184
let entity = arg.ask_entity_type()?;
187185
do_create_entity(entity, found, arg)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy