Skip to content

Commit 07c483e

Browse files
author
developerworks
committed
Fix supervisor example child builder and clippy lint config
- remove incorrect global std::fs bans from clippy config comments - correct worker child spec builder return in supervisor example
1 parent 9848d15 commit 07c483e

2 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎clippy.toml‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# Disallow blocking I/O, synchronous locks, and raw OS process spawns in
2-
# asynchronous contexts. Subtask code must use tokio::fs, tokio::net,
3-
# tokio::sync::Mutex, tokio::time::sleep, and tokio::process::Command instead.
1+
# This lint is global and cannot detect whether a call is inside an async
2+
# runtime context. Keep only APIs that should be banned everywhere. Blocking
3+
# filesystem calls are intentionally not listed because sync CLI and test code
4+
# use them outside async runtime contexts.
45
disallowed-methods = [
5-
"std::fs::read",
6-
"std::fs::write",
7-
{ path = "std::fs::File", allow-invalid = true },
86
{ path = "std::net::TcpStream", allow-invalid = true },
97
"std::thread::sleep",
108
{ path = "std::sync::Mutex", allow-invalid = true },

‎examples/supervisor_tree_story.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fn worker(id: &str, name: &str) -> Result<ChildSpec, SupervisorError> {
100100
});
101101

102102
// Create the worker child specification.
103-
Ok(ChildSpec::worker(
103+
ChildSpec::worker(
104104
// Set the child identifier.
105105
ChildId::new(id),
106106
// Set the child name.
@@ -110,7 +110,7 @@ fn worker(id: &str, name: &str) -> Result<ChildSpec, SupervisorError> {
110110
// Store the task factory behind shared ownership.
111111
Arc::new(factory),
112112
// Finish the worker child specification.
113-
)?)
113+
)
114114
// Finish the worker builder.
115115
}
116116

0 commit comments

Comments
 (0)