Skip to content

Commit 2c9cc73

Browse files
committed
fixes
1 parent df68efd commit 2c9cc73

File tree

7 files changed

+17
-15
lines changed

7 files changed

+17
-15
lines changed

Chapter10/command-line-args/src/main.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ impl Exclusion {
1616
fn walk(
1717
dir: &Path,
1818
exclusion: &Option<Exclusion>,
19-
cb: &Fn(&DirEntry),
19+
cb: &dyn Fn(&DirEntry),
2020
recurse: bool,
2121
) -> io::Result<()> {
2222
for entry in dir.read_dir()? {
@@ -86,10 +86,9 @@ fn main() -> io::Result<()> {
8686
)
8787
.get_matches();
8888

89-
let filter_conf = matches.value_of("match").unwrap_or("");
9089
let recurse = matches.is_present("recursive");
9190
let exclusions = matches.value_of("exclude").map(|e| Exclusion(e.into()));
92-
91+
9392
match matches.subcommand() {
9493
("files", Some(subcmd)) => {
9594
let path = Path::new(subcmd.value_of("PATH").unwrap());

Chapter10/logging/log4rs.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Scan this file for changes every 30 seconds
21
refresh_rate: 30 seconds
32

43
appenders:
@@ -20,5 +19,4 @@ loggers:
2019
special-target:
2120
level: info
2221
appenders:
23-
- outfile
24-
additive: false
22+
- outfile

Chapter10/logging/outfile.log

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
2019-08-20T13:18:17.023781824+02:00 - WARNING, stuff is breaking down
2-
2019-08-21T18:50:13.813701633+02:00 - WARNING, stuff is breaking down
1+
2019-09-01T12:45:25.256922311+02:00 - WARNING, stuff is breaking down

Chapter10/logging/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ fn log_some_stuff() {
5050
error!("ERROR: stopping ...");
5151
}
5252

53-
const USE_CUSTOM: bool = false;
53+
const USE_CUSTOM: bool = true;
5454

5555
fn main() {
5656
if USE_CUSTOM {

Chapter10/rusty-ml/models/best.ot

-2.22 MB
Binary file not shown.

Chapter10/rusty-ml/models/latest.tch

-2.22 MB
Binary file not shown.

Chapter10/sub-processes/src/main.rs

+12-6
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,27 @@ use std::process::{Command, Stdio};
44

55
fn main() -> Result<(), Box<dyn Error + Send + Sync + 'static>> {
66
let mut ls_child = Command::new("ls");
7-
ls_child.args(&["-alh"]);
8-
ls_child.status()?;
7+
if !cfg!(target_os = "windows") {
8+
ls_child.args(&["-alh"]);
9+
}
10+
println!("{}", ls_child.status()?);
911
ls_child.current_dir("src/");
10-
12+
println!("{}", ls_child.status()?);
13+
1114
let env_child = Command::new("env")
1215
.env("CANARY", "0x5ff")
1316
.stdout(Stdio::piped())
1417
.spawn()?;
15-
18+
1619
let env_output = &env_child.wait_with_output()?;
17-
let canary = String::from_utf8_lossy(&env_output.stdout).split_ascii_whitespace().filter(|line| *line == "CANARY=0x5ff").count();
20+
let canary = String::from_utf8_lossy(&env_output.stdout)
21+
.split_ascii_whitespace()
22+
.filter(|line| *line == "CANARY=0x5ff")
23+
.count();
1824

1925
// found it!
2026
assert_eq!(canary, 1);
21-
27+
2228
let mut rev_child = Command::new("rev")
2329
.stdin(Stdio::piped())
2430
.stdout(Stdio::piped())

0 commit comments

Comments
 (0)