summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2021-03-25 18:51:18 +0100
committerCanop <cano.petrole@gmail.com>2021-03-25 18:51:18 +0100
commit1aed834b086f30db760ae2d1ea2d1aa89b595d50 (patch)
tree41b5ccdd468bb66b9353a461bbf33f2ac6d56f0c
parent75ee6c28b082dd3e5ff095f1dcd053dbdc0fa972 (diff)
replace criterion with glassbench for benchmarking
-rw-r--r--.gitignore1
-rw-r--r--Cargo.lock370
-rw-r--r--Cargo.toml4
-rw-r--r--benches/composite.rs22
-rw-r--r--benches/fuzzy.rs18
-rw-r--r--benches/path_normalization.rs16
-rw-r--r--src/skin/purpose_mad_skin.rs19
-rw-r--r--src/skin/status_mad_skin.rs36
8 files changed, 199 insertions, 287 deletions
diff --git a/.gitignore b/.gitignore
index 2099381..1ed9a1b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,4 @@ screens
build
trav
press
+/.glassbench
diff --git a/Cargo.lock b/Cargo.lock
index dad117e..ed7ea45 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -52,6 +52,41 @@ dependencies = [
]
[[package]]
+name = "anyhow"
+version = "1.0.39"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "81cddc5f91628367664cc7c69714ff08deee8a3efc54623011c772544d7b2767"
+
+[[package]]
+name = "argh"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "91792f088f87cdc7a2cfb1d617fa5ea18d7f1dc22ef0e1b5f82f3157cdc522be"
+dependencies = [
+ "argh_derive",
+ "argh_shared",
+]
+
+[[package]]
+name = "argh_derive"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c4eb0c0c120ad477412dc95a4ce31e38f2113e46bd13511253f79196ca68b067"
+dependencies = [
+ "argh_shared",
+ "heck",
+ "proc-macro2",
+ "quote",
+ "syn",
+]
+
+[[package]]
+name = "argh_shared"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "781f336cc9826dbaddb9754cb5db61e64cab4f69668bd19dcc4a0394a86f4cb1"
+
+[[package]]
name = "arrayref"
version = "0.3.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -130,8 +165,7 @@ dependencies = [
"char_reader",
"chrono",
"clap",
- "cli-log",
- "criterion",
+ "cli-log 1.2.0",
"crossbeam",
"crossterm",
"custom_error",
@@ -140,6 +174,7 @@ dependencies = [
"file-size",
"fnv",
"git2",
+ "glassbench",
"glob",
"id-arena",
"image",
@@ -184,12 +219,6 @@ dependencies = [
]
[[package]]
-name = "bumpalo"
-version = "3.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe"
-
-[[package]]
name = "bytemuck"
version = "1.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -202,15 +231,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]]
-name = "cast"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4b9434b9a5aa1450faa3f9cb14ea0e8c53bb5d2b3c1bfd1ab4fc03e9f33fbfb0"
-dependencies = [
- "rustc_version",
-]
-
-[[package]]
name = "cc"
version = "1.0.67"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -246,6 +266,7 @@ dependencies = [
"libc",
"num-integer",
"num-traits",
+ "serde",
"time",
"winapi",
]
@@ -267,6 +288,16 @@ dependencies = [
[[package]]
name = "cli-log"
+version = "0.1.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f47673f2992075892b3e983499410c92af91a7d7cee72cf55ec4caea278de6cf"
+dependencies = [
+ "chrono",
+ "log",
+]
+
+[[package]]
+name = "cli-log"
version = "1.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "690194554a14b440fed58d86ca02f6fc45f3726e0cbb73e15168652eeae61a0a"
@@ -310,42 +341,6 @@ dependencies = [
]
[[package]]
-name = "criterion"
-version = "0.3.4"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ab327ed7354547cc2ef43cbe20ef68b988e70b4b593cbd66a2a61733123a3d23"
-dependencies = [
- "atty",
- "cast",
- "clap",
- "criterion-plot",
- "csv",
- "itertools 0.10.0",
- "lazy_static",
- "num-traits",
- "oorandom",
- "plotters",
- "rayon",
- "regex",
- "serde",
- "serde_cbor",
- "serde_derive",
- "serde_json",
- "tinytemplate",
- "walkdir",
-]
-
-[[package]]
-name = "criterion-plot"
-version = "0.4.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e022feadec601fba1649cfa83586381a4ad31c6bf3a9ab7d408118b05dd9889d"
-dependencies = [
- "cast",
- "itertools 0.9.0",
-]
-
-[[package]]
name = "crossbeam"
version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -462,6 +457,26 @@ dependencies = [
]
[[package]]
+name = "csv2svg"
+version = "0.1.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1b29b8c39dc8a008d498bed2fa5a8ba779eee1d3f2c25fa25380fa109912ca3"
+dependencies = [
+ "anyhow",
+ "argh",
+ "chrono",
+ "cli-log 0.1.0",
+ "csv",
+ "directories-next",
+ "libc",
+ "log",
+ "num-traits",
+ "open",
+ "svg",
+ "tempfile",
+]
+
+[[package]]
name = "custom_error"
version = "1.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -497,13 +512,34 @@ dependencies = [
]
[[package]]
+name = "directories-next"
+version = "2.0.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "339ee130d97a610ea5a5872d2bbb130fdf68884ff09d3028b81bec8a1ac23bbc"
+dependencies = [
+ "cfg-if 1.0.0",
+ "dirs-sys-next",
+]
+
+[[package]]
name = "dirs-sys"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e93d7f5705de3e49895a2b5e0b8855a1c27f080192ae9c32a6432d50741a57a"
dependencies = [
"libc",
- "redox_users",
+ "redox_users 0.3.5",
+ "winapi",
+]
+
+[[package]]
+name = "dirs-sys-next"
+version = "0.1.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d"
+dependencies = [
+ "libc",
+ "redox_users 0.4.0",
"winapi",
]
@@ -603,16 +639,30 @@ dependencies = [
]
[[package]]
-name = "glob"
-version = "0.3.0"
+name = "glassbench"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
+checksum = "782363e9a7f23b1a3c31583666a0f63f3692e2d751e954e158247491f8b8f495"
+dependencies = [
+ "chrono",
+ "crossterm",
+ "csv2svg",
+ "lazy_static",
+ "minimad",
+ "open",
+ "serde",
+ "serde_json",
+ "svg",
+ "tempfile",
+ "termimad",
+ "thiserror",
+]
[[package]]
-name = "half"
-version = "1.7.1"
+name = "glob"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "62aca2aba2d62b4a7f5b33f3712cb1b0692779a56fb510499d5c0aa594daeaf3"
+checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
[[package]]
name = "hashbrown"
@@ -621,6 +671,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
[[package]]
+name = "heck"
+version = "0.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac"
+dependencies = [
+ "unicode-segmentation",
+]
+
+[[package]]
name = "hermit-abi"
version = "0.1.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -694,24 +753,6 @@ dependencies = [
]
[[package]]
-name = "itertools"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b"
-dependencies = [
- "either",
-]
-
-[[package]]
-name = "itertools"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "37d572918e350e82412fe766d24b15e6682fb2ed2bbe018280caa810397cb319"
-dependencies = [
- "either",
-]
-
-[[package]]
name = "itoa"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -736,15 +777,6 @@ dependencies = [
]
[[package]]
-name = "js-sys"
-version = "0.3.48"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "dc9f84f9b115ce7843d60706df1422a916680bfdfcbdb0447c5614ff9d7e4d78"
-dependencies = [
- "wasm-bindgen",
-]
-
-[[package]]
name = "lazy-regex"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1009,12 +1041,6 @@ dependencies = [
]
[[package]]
-name = "oorandom"
-version = "11.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0ab1bc2a289d34bd04a330323ac98a1b4bc82c9d9fcb1e66b63caa84da26b575"
-
-[[package]]
name = "open"
version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1126,34 +1152,6 @@ dependencies = [
]
[[package]]
-name = "plotters"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "45ca0ae5f169d0917a7c7f5a9c1a3d3d9598f18f529dd2b8373ed988efea307a"
-dependencies = [
- "num-traits",
- "plotters-backend",
- "plotters-svg",
- "wasm-bindgen",
- "web-sys",
-]
-
-[[package]]
-name = "plotters-backend"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b07fffcddc1cb3a1de753caa4e4df03b79922ba43cf882acc1bdd7e8df9f4590"
-
-[[package]]
-name = "plotters-svg"
-version = "0.3.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b38a02e23bd9604b842a812063aec4ef702b57989c37b655254bb61c471ad211"
-dependencies = [
- "plotters-backend",
-]
-
-[[package]]
name = "png"
version = "0.16.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1347,6 +1345,16 @@ dependencies = [
]
[[package]]
+name = "redox_users"
+version = "0.4.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64"
+dependencies = [
+ "getrandom 0.2.2",
+ "redox_syscall 0.2.5",
+]
+
+[[package]]
name = "regex"
version = "1.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1394,15 +1402,6 @@ dependencies = [
]
[[package]]
-name = "rustc_version"
-version = "0.2.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
-dependencies = [
- "semver",
-]
-
-[[package]]
name = "ryu"
version = "1.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1445,21 +1444,6 @@ dependencies = [
]
[[package]]
-name = "semver"
-version = "0.9.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
-dependencies = [
- "semver-parser",
-]
-
-[[package]]
-name = "semver-parser"
-version = "0.7.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
-
-[[package]]
name = "serde"
version = "1.0.124"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1469,16 +1453,6 @@ dependencies = [
]
[[package]]
-name = "serde_cbor"
-version = "0.11.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e18acfa2f90e8b735b2836ab8d538de304cbb6729a7360729ea5a895d15a622"
-dependencies = [
- "half",
- "serde",
-]
-
-[[package]]
name = "serde_derive"
version = "1.0.124"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1568,6 +1542,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a"
[[package]]
+name = "svg"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "3bdb25a4593d6656239319426f4025f7a658157e25e89f0e0319d7516d46042d"
+
+[[package]]
name = "syn"
version = "1.0.64"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1696,16 +1676,6 @@ dependencies = [
]
[[package]]
-name = "tinytemplate"
-version = "1.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "be4d6b5f19ff7664e8c98d03e2139cb510db9b0a60b55f8e8709b689d939b6bc"
-dependencies = [
- "serde",
- "serde_json",
-]
-
-[[package]]
name = "tinyvec"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1754,6 +1724,12 @@ dependencies = [
]
[[package]]
+name = "unicode-segmentation"
+version = "1.7.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "bb0d2e7be6ae3a5fa87eed5fb451aff96f2573d2694942e40543ae0bbe19c796"
+
+[[package]]
name = "unicode-width"
version = "0.1.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1829,70 +1805,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6"
[[package]]
-name = "wasm-bindgen"
-version = "0.2.71"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7ee1280240b7c461d6a0071313e08f34a60b0365f14260362e5a2b17d1d31aa7"
-dependencies = [
- "cfg-if 1.0.0",
- "wasm-bindgen-macro",
-]
-
-[[package]]
-name = "wasm-bindgen-backend"
-version = "0.2.71"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "5b7d8b6942b8bb3a9b0e73fc79b98095a27de6fa247615e59d096754a3bc2aa8"
-dependencies = [
- "bumpalo",
- "lazy_static",
- "log",
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-macro"
-version = "0.2.71"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e5ac38da8ef716661f0f36c0d8320b89028efe10c7c0afde65baffb496ce0d3b"
-dependencies = [
- "quote",
- "wasm-bindgen-macro-support",
-]
-
-[[package]]
-name = "wasm-bindgen-macro-support"
-version = "0.2.71"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "cc053ec74d454df287b9374ee8abb36ffd5acb95ba87da3ba5b7d3fe20eb401e"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
- "wasm-bindgen-backend",
- "wasm-bindgen-shared",
-]
-
-[[package]]
-name = "wasm-bindgen-shared"
-version = "0.2.71"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7d6f8ec44822dd71f5f221a5847fb34acd9060535c1211b70a05844c0f6383b1"
-
-[[package]]
-name = "web-sys"
-version = "0.3.48"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ec600b26223b2948cedfde2a0aa6756dcf1fef616f43d7b3097aaf53a6c4d92b"
-dependencies = [
- "js-sys",
- "wasm-bindgen",
-]
-
-[[package]]
name = "weezl"
version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 674a0a6..312922f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -62,9 +62,8 @@ toml = "0.5"
umask = "1.0"
unicode-width = "0.1.8"
-
[dev-dependencies]
-criterion = "0.3.1"
+glassbench = "0.1.0"
[target.'cfg(unix)'.dependencies]
lfs-core = "0.3.1"
@@ -102,6 +101,7 @@ harness = false
# termimad = { path = "../termimad" }
# crossterm = { path = "../crossterm-rs/crossterm" }
# deser-hjson = { path = "../deser-hjson" }
+# glassbench = { path = "../glassbench" }
# umask = { path = "../umask" }
# secular = { path = "../secular", features=["normalization"] }
# strict = { path = "../strict" }
diff --git a/benches/composite.rs b/benches/composite.rs
index bde4505..77efb5d 100644
--- a/benches/composite.rs
+++ b/benches/composite.rs
@@ -5,34 +5,34 @@ use {
command::CommandParts,
pattern::*,
},
- criterion::{black_box, criterion_group, criterion_main, Criterion},
+ glassbench::*,
};
// this file benches composite patterns on file names so don't
// use file content sub patterns here
static PATTERNS: &[&str] = &[
+ "réveil",
"r&!e",
+ "(!e&!b)|c",
];
-fn score_of_composite_benchmark(c: &mut Criterion) {
+fn bench_score_of_composite(gb: &mut GlassBench) {
let search_modes = SearchModeMap::default();
for pattern in PATTERNS {
- let task = format!("Pattern({:?})::score_of", &pattern);
- let parts = CommandParts::from(pattern.to_string());
- c.bench_function(&task, |b| {
+ let name = format!("Composite({:?})::score_of", &pattern);
+ gb.task(name, |b| {
+ let parts = CommandParts::from(pattern.to_string());
let cp = Pattern::new(&parts.pattern, &search_modes).unwrap();
b.iter(|| {
for name in shared::NAMES {
- black_box(cp.score_of_string(name));
+ pretend_used(cp.score_of_string(name));
}
});
});
}
}
-criterion_group!(
- name = composite;
- config = Criterion::default().without_plots();
- targets = score_of_composite_benchmark,
+glassbench!(
+ "Composite Patterns",
+ bench_score_of_composite,
);
-criterion_main!(composite);
diff --git a/benches/fuzzy.rs b/benches/fuzzy.rs
index 6f4ebcc..d635f99 100644
--- a/benches/fuzzy.rs
+++ b/benches/fuzzy.rs
@@ -2,28 +2,26 @@ mod shared;
use {
broot::pattern::FuzzyPattern,
- criterion::{black_box, criterion_group, criterion_main, Criterion},
+ glassbench::*,
};
static PATTERNS: &[&str] = &["réveil", "AB", "e", "brt", "brootz"];
-fn score_of_benchmark(c: &mut Criterion) {
+fn bench_score_of_fuzzy(gb: &mut GlassBench) {
for pattern in PATTERNS {
- let task = format!("FuzzyPattern({:?})::score_of", pattern);
- c.bench_function(&task, |b| {
+ let task_name = format!("Fuzzy({:?})::score_of", pattern);
+ gb.task(task_name, |b| {
let fp = FuzzyPattern::from(pattern);
b.iter(|| {
for name in shared::NAMES {
- black_box(fp.score_of(name));
+ pretend_used(fp.score_of(name));
}
});
});
}
}
-criterion_group!(
- name = fuzzy;
- config = Criterion::default().without_plots();
- targets = score_of_benchmark,
+glassbench!(
+ "Fuzzy Patterns",
+ bench_score_of_fuzzy,
);
-criterion_main!(fuzzy);
diff --git a/benches/path_normalization.rs b/benches/path_normalization.rs
index a481684..8bdeb4c 100644
--- a/benches/path_normalization.rs
+++ b/benches/path_normalization.rs
@@ -1,6 +1,6 @@
use {
broot::path,
- criterion::{black_box, criterion_group, criterion_main, Criterion},
+ glassbench::*,
};
static PATHS: &[&str] = &[
@@ -20,19 +20,17 @@ static PATHS: &[&str] = &[
"π/2",
];
-fn normalization_benchmark(c: &mut Criterion) {
- c.bench_function("normalize_path", |b| {
+fn bench_normalization(gb: &mut GlassBench) {
+ gb.task("normalize_path", |b| {
b.iter(|| {
for path in PATHS {
- black_box(path::normalize_path(path));
+ pretend_used(path::normalize_path(path));
}
});
});
}
-criterion_group!(
- name = path_normalization;
- config = Criterion::default().without_plots();
- targets = normalization_benchmark,
+glassbench!(
+ "Path Normalization",
+ bench_normalization,
);
-criterion_main!(path_normalization);
diff --git a/src/skin/purpose_mad_skin.rs b/src/skin/purpose_mad_skin.rs
index 0429e0a..58ca86f 100644
--- a/src/skin/purpose_mad_skin.rs
+++ b/src/skin/purpose_mad_skin.rs
@@ -7,14 +7,15 @@ use {
/// build a MadSkin which will be used to display the status
/// when there's no error
pub fn make_purpose_mad_skin(skin: &StyleMap) -> MadSkin {
- let mut mad_skin = MadSkin::default();
- mad_skin.paragraph = LineStyle {
- compound_style: skin.purpose_normal.clone(),
- align: Alignment::Left,
- };
- mad_skin.italic = skin.purpose_italic.clone();
- mad_skin.bold = skin.purpose_bold.clone();
- mad_skin.ellipsis = skin.purpose_ellipsis.clone();
- mad_skin
+ MadSkin {
+ paragraph: LineStyle {
+ compound_style: skin.purpose_normal.clone(),
+ align: Alignment::Left,
+ },
+ italic: skin.purpose_italic.clone(),
+ bold: skin.purpose_bold.clone(),
+ ellipsis: skin.purpose_ellipsis.clone(),
+ ..Default::default()
+ }
}
diff --git a/src/skin/status_mad_skin.rs b/src/skin/status_mad_skin.rs
index ea1fbc0..b0732f7 100644
--- a/src/skin/status_mad_skin.rs
+++ b/src/skin/status_mad_skin.rs
@@ -13,28 +13,30 @@ pub struct StatusMadSkinSet {
/// build a MadSkin which will be used to display the status
/// when there's no error
fn make_normal_status_mad_skin(skin: &StyleMap) -> MadSkin {
- let mut mad_skin = MadSkin::default();
- mad_skin.paragraph = LineStyle {
- compound_style: skin.status_normal.clone(),
- align: Alignment::Left,
- };
- mad_skin.italic = skin.status_italic.clone();
- mad_skin.bold = skin.status_bold.clone();
- mad_skin.inline_code = skin.status_code.clone();
- mad_skin.ellipsis = skin.status_ellipsis.clone();
- mad_skin
+ MadSkin {
+ paragraph: LineStyle {
+ compound_style: skin.status_normal.clone(),
+ align: Alignment::Left,
+ },
+ italic: skin.status_italic.clone(),
+ bold: skin.status_bold.clone(),
+ inline_code: skin.status_code.clone(),
+ ellipsis: skin.status_ellipsis.clone(),
+ ..Default::default()
+ }
}
/// build a MadSkin which will be used to display the status
/// when there's a error
fn make_error_status_mad_skin(skin: &StyleMap) -> MadSkin {
- let mut mad_skin = MadSkin::default();
- mad_skin.paragraph = LineStyle {
- compound_style: skin.status_error.clone(),
- align: Alignment::Left,
- };
- mad_skin.ellipsis = skin.status_ellipsis.clone();
- mad_skin
+ MadSkin {
+ paragraph: LineStyle {
+ compound_style: skin.status_error.clone(),
+ align: Alignment::Left,
+ },
+ ellipsis: skin.status_ellipsis.clone(),
+ ..Default::default()
+ }
}
impl StatusMadSkinSet {