Skip to content

Commit f92c46f

Browse files
committed
fixing cyclic dependency problem
1 parent f0a6898 commit f92c46f

File tree

13 files changed

+79
-53
lines changed

13 files changed

+79
-53
lines changed

Cargo.toml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,4 +536,14 @@ version = "0.1.83"
536536
[workspace.dependencies.tokio]
537537
version = "1.41.0"
538538
features = []
539-
default-features = false
539+
default-features = false
540+
541+
[workspace.dependencies.anyhow]
542+
version = "~1.0"
543+
# features = []
544+
# default-features = false
545+
546+
[workspace.dependencies.thiserror]
547+
version = "~1.0"
548+
# features = []
549+
# default-features = false

module/core/error_tools/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,9 @@ error_untyped = [ "anyhow" ]
4848
# = entry
4949

5050
[dependencies]
51-
anyhow = { version = "~1.0", optional = true }
52-
thiserror = { version = "~1.0", optional = true }
51+
anyhow = { workspace = true, optional = true }
52+
thiserror = { workspace = true, optional = true }
5353

5454
[dev-dependencies]
5555
test_tools = { workspace = true }
56+
# xxx : qqq : review

module/core/error_tools/src/error.rs renamed to module/core/error_tools/src/error/mod.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,13 @@ pub mod typed;
223223
/// Untyped exceptions handling mechanism.
224224
pub mod untyped;
225225

226+
#[ cfg( feature = "enabled" ) ]
226227
#[ doc( inline ) ]
227228
#[ allow( unused_imports ) ]
228229
pub use own::*;
229230

230231
/// Own namespace of the module.
232+
#[ cfg( feature = "enabled" ) ]
231233
#[ allow( unused_imports ) ]
232234
pub mod own
233235
{
@@ -256,16 +258,16 @@ pub mod own
256258
// BasicError,
257259
};
258260

259-
pub use super::
260-
{
261-
assert,
262-
typed,
263-
untyped,
264-
};
261+
pub use super::assert;
262+
#[ cfg( feature = "error_typed" ) ]
263+
pub use super::typed;
264+
#[ cfg( feature = "error_untyped" ) ]
265+
pub use super::untyped;
265266

266267
}
267268

268269
/// Shared with parent namespace of the module
270+
#[ cfg( feature = "enabled" ) ]
269271
#[ allow( unused_imports ) ]
270272
pub mod orphan
271273
{
@@ -275,6 +277,7 @@ pub mod orphan
275277
}
276278

277279
/// Exposed namespace of the module.
280+
#[ cfg( feature = "enabled" ) ]
278281
#[ allow( unused_imports ) ]
279282
pub mod exposed
280283
{
@@ -304,6 +307,7 @@ pub mod exposed
304307
}
305308

306309
/// Prelude to use essentials: `use my_module::prelude::*`.
310+
#[ cfg( feature = "enabled" ) ]
307311
#[ allow( unused_imports ) ]
308312
pub mod prelude
309313
{

module/core/test_tools/Cargo.toml

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,12 @@ all-features = false
2727
# = features
2828

2929
[features]
30-
default = [ "enabled" ]
31-
full = [ "enabled" ]
30+
default = [
31+
"enabled",
32+
"error_typed",
33+
"error_untyped",
34+
]
35+
full = [ "default" ]
3236
no_std = [
3337
# "error_tools/no_std",
3438
# "meta_tools/no_std",
@@ -62,20 +66,22 @@ enabled = [
6266
]
6367
# nightly = [ "typing_tools/nightly" ]
6468

69+
error_typed = []
70+
error_untyped = []
71+
6572
[dependencies]
6673

6774
## external
6875

69-
paste = "~1.0" # zzz : remove laster
76+
# paste = "~1.0" # zzz : remove later
7077
rustversion = "~1.0"
71-
# anyhow = "~1.0"
7278
num-traits = "~0.2"
7379
trybuild = { version = "1.0.85", features = [ "diff" ] }
7480
rand = "0.8.5"
7581

7682
## internal
7783

78-
error_tools = { workspace = true, features = [ "full" ] }
84+
# error_tools = { workspace = true, features = [ "full" ] }
7985
meta_tools = { workspace = true, features = [ "full" ] }
8086
mem_tools = { workspace = true, features = [ "full" ] }
8187
typing_tools = { workspace = true, features = [ "full" ] }
@@ -86,5 +92,10 @@ collection_tools = { workspace = true, features = [ "full" ] }
8692

8793
# former_stable = { workspace = true, features = [ "full" ] }
8894

95+
## transient
96+
97+
anyhow = { workspace = true }
98+
thiserror = { workspace = true }
99+
89100
[build-dependencies]
90101
rustc_version = "0.4"

module/core/test_tools/src/lib.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
pub mod dependency
1212
{
1313

14-
// zzz : exclude later
15-
#[ doc( inline ) ]
16-
pub use ::paste;
14+
// // zzz : exclude later
15+
// #[ doc( inline ) ]
16+
// pub use ::paste;
1717
#[ doc( inline ) ]
1818
pub use ::trybuild;
1919
#[ doc( inline ) ]
@@ -41,8 +41,8 @@ pub mod dependency
4141

4242
}
4343

44-
// #[ path = "../../../core/error_tools/src/lib.rs" ]
45-
// pub mod error_tools;
44+
#[ path = "../../../core/error_tools/src/error/mod.rs" ]
45+
pub mod error_tools;
4646

4747
mod private {}
4848

module/move/willbe/src/action/cicd_renew.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ mod private
1919
use error::
2020
{
2121
typed::Error,
22-
err,
22+
// err,
2323
};
2424

2525
#[ derive( Debug, Error ) ]
@@ -375,7 +375,7 @@ mod private
375375
return url::repo_url_extract( &url )
376376
.and_then( | url | url::git_info_extract( &url ).ok() )
377377
.map( UsernameAndRepository )
378-
.ok_or_else( || err!( "Fail to parse repository url from workspace Cargo.toml"))
378+
.ok_or_else( || error::untyped::format_err!( "Fail to parse repository url from workspace Cargo.toml"))
379379
}
380380
else
381381
{
@@ -393,7 +393,7 @@ mod private
393393
.and_then( | url | url::repo_url_extract( &url ) )
394394
.and_then( | url | url::git_info_extract( &url ).ok() )
395395
.map( UsernameAndRepository )
396-
.ok_or_else( || err!( "Fail to extract repository url") )
396+
.ok_or_else( || error::untyped::format_err!( "Fail to extract repository url") )
397397
}
398398
}
399399

module/move/willbe/src/action/list.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ mod private
1313
};
1414
use error::
1515
{
16-
ErrWith, err,
16+
ErrWith,
1717
untyped::{ Context, format_err },
1818
};
1919
use tool::{ TreePrinter, ListNodeReport };
@@ -39,7 +39,7 @@ mod private
3939
{
4040
"tree" => ListFormat::Tree,
4141
"toposort" => ListFormat::Topological,
42-
e => return Err( err!( "Unknown format '{}'. Available values : [tree, toposort]", e ))
42+
e => return Err( error::untyped::format_err!( "Unknown format '{}'. Available values : [tree, toposort]", e ))
4343
};
4444

4545
Ok( value )
@@ -105,7 +105,7 @@ mod private
105105
{
106106
"nothing" => ListFilter::Nothing,
107107
"local" => ListFilter::Local,
108-
e => return Err( err!( "Unknown filter '{}'. Available values : [nothing, local]", e ) )
108+
e => return Err( error::untyped::format_err!( "Unknown filter '{}'. Available values : [nothing, local]", e ) )
109109
};
110110

111111
Ok( value )

module/move/willbe/src/action/main_header.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ mod private
1818
use entity::{ PathError, WorkspaceInitError };
1919
use error::
2020
{
21-
err,
22-
untyped::Error,
21+
// err,
22+
// untyped::Error,
2323
};
2424
use workspace_md_extension::WorkspaceMdExtension;
2525

@@ -86,7 +86,7 @@ mod private
8686
{
8787
/// Represents a common error.
8888
#[ error( "Common error: {0}" ) ]
89-
Common(#[ from ] Error ),
89+
Common( #[ from ] error::untyped::Error ), // qqq : rid of
9090
/// Represents an I/O error.
9191
#[ error( "I/O error: {0}" ) ]
9292
IO( #[ from ] std::io::Error ),
@@ -116,14 +116,14 @@ mod private
116116
// aaa : done
117117
let repository_url = workspace
118118
.repository_url()
119-
.ok_or_else::< Error, _ >
120-
( || err!( "repo_url not found in workspace Cargo.toml" ) )?;
119+
.ok_or_else::< error::untyped::Error, _ >
120+
( || error::untyped::format_err!( "repo_url not found in workspace Cargo.toml" ) )?;
121121

122122
let master_branch = workspace.master_branch().unwrap_or( "master".into() );
123123
let workspace_name = workspace
124124
.workspace_name()
125-
.ok_or_else::< Error, _ >
126-
( || err!( "workspace_name not found in workspace Cargo.toml" ) )?;
125+
.ok_or_else::< error::untyped::Error, _ >
126+
( || error::untyped::format_err!( "workspace_name not found in workspace Cargo.toml" ) )?;
127127

128128
let discord_url = workspace.discord_url();
129129

module/move/willbe/src/action/readme_modules_headers_renew.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ mod private
2020
use package::Package;
2121
use error::
2222
{
23-
err,
23+
// err,
2424
untyped::
2525
{
2626
// Result,
27-
Error as wError,
27+
// Error as wError,
2828
Context,
2929
},
3030
};
@@ -101,7 +101,7 @@ mod private
101101
{
102102
/// Represents a common error.
103103
#[ error( "Common error: {0}" ) ]
104-
Common(#[ from ] wError ),
104+
Common(#[ from ] error::untyped::Error ), // qqq : rid of
105105
/// Represents an I/O error.
106106
#[ error( "I/O error: {0}" ) ]
107107
IO( #[ from ] std::io::Error ),
@@ -140,7 +140,7 @@ mod private
140140
let stability = package.stability()?;
141141
let module_name = package.name()?;
142142
let repository_url = package.repository()?
143-
.ok_or_else::< wError, _ >( || err!( "Fail to find repository_url in module`s Cargo.toml" ) )?;
143+
.ok_or_else::< error::untyped::Error, _ >( || error::untyped::format_err!( "Fail to find repository_url in module`s Cargo.toml" ) )?;
144144

145145
let discord_url = package
146146
.discord_url()?
@@ -172,7 +172,7 @@ mod private
172172

173173
let repo_url = url::repo_url_extract( &self.repository_url )
174174
.and_then( | r | url::git_info_extract( &r ).ok() )
175-
.ok_or_else::< wError, _ >( || err!( "Fail to parse repository url" ) )?;
175+
.ok_or_else::< error::untyped::Error, _ >( || error::untyped::format_err!( "Fail to parse repository url" ) )?;
176176
let example= if let Some( name ) = find_example_file
177177
(
178178
self.module_path.as_path(),
@@ -269,7 +269,7 @@ mod private
269269
.join
270270
(
271271
repository::readme_path( path.parent().unwrap().as_ref() )
272-
// .ok_or_else::< wError, _ >( || err!( "Fail to find README.md at {}", &path ) )
272+
// .ok_or_else::< error::untyped::Error, _ >( || error::untyped::format_err!( "Fail to find README.md at {}", &path ) )
273273
.err_with_report( &report )?
274274
);
275275

module/move/willbe/src/command/readme_headers_renew.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ mod private
22
{
33
use crate::*;
44
use action;
5-
use error::{ err };
5+
// use error::{ err };
66
use std::fmt::{ Display, Formatter };
77

88
#[ derive( Debug, Default ) ]
@@ -103,7 +103,7 @@ mod private
103103
if fail
104104
{
105105
eprintln!( "{report}" );
106-
Err( err!( "Something went wrong" ) )
106+
Err( error::untyped::format_err!( "Something went wrong" ) )
107107
}
108108
else
109109
{

0 commit comments

Comments
 (0)