Skip to content

Commit a57c4bb

Browse files
committed
chore: fix up minor annoyances
1 parent 42cfbae commit a57c4bb

File tree

6 files changed

+17
-21
lines changed

6 files changed

+17
-21
lines changed

.extras/snippets/cli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ use crate::prelude::*;
1212
author = crate::crate_authors!(),
1313
version = crate::crate_version!(),
1414
about = crate::crate_description!(),
15-
long_about = "\n\
16-
Put your long desc. here
17-
",
15+
long_about = "\n
16+
Put your long desc. here
17+
",
1818
arg_required_else_help = true,
1919
// Allows for the custom parsing of the version flag
2020
disable_version_flag = true,

.extras/snippets/macros/simple.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ macro_rules! some {
6262
/// assert_eq!(m, "rust_template");
6363
///
6464
/// ```
65-
#[cfg(feature = "cargo")]
6665
#[macro_export]
6766
macro_rules! crate_name {
6867
() => {
@@ -89,7 +88,6 @@ macro_rules! crate_name {
8988
/// assert_eq!(m, "author1 lastname <author1@example.com>:author2 lastname <author2@example.com>"
9089
///
9190
/// ```
92-
#[cfg(feature = "cargo")]
9391
#[macro_export]
9492
macro_rules! crate_authors {
9593
($sep:expr) => {{
@@ -121,7 +119,6 @@ macro_rules! crate_authors {
121119
/// assert_eq!(m, "0.1.0");
122120
///
123121
/// ```
124-
#[cfg(feature = "cargo")]
125122
#[macro_export]
126123
macro_rules! crate_version {
127124
() => {
@@ -141,7 +138,6 @@ macro_rules! crate_version {
141138
/// assert_eq!(m, "A description of the crate");
142139
///
143140
/// ```
144-
#[cfg(feature = "cargo")]
145141
#[macro_export]
146142
macro_rules! crate_description {
147143
() => {

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
cargo-features = ["codegen-backend", "profile-rustflags", "trim-paths"]
1+
cargo-features = [ "codegen-backend", "profile-rustflags", "trim-paths" ]
22
# cargo-features = ["profile-rustflags", "trim-paths"] # required for both trimming paths and setting rustflags
33
# The aboe also needs the profile.dev to be uncommented to use the cranelift backend
44
[package]
55
name = "rust_template"
66
version = "0.1.0"
7-
authors = ["MrDwarf7", "Blake B. <github.com/MrDwarf7>"]
7+
authors = [ "MrDwarf7", "Blake B. <github.com/MrDwarf7>" ]
88
edition = "2024"
99
description = "It does cool stuff!"
1010
# license = "MIT"
@@ -84,7 +84,6 @@ thiserror = "*"
8484
opt-level = 1
8585
codegen-units = 256
8686
incremental = true
87-
rustflags = ["-Zthreads=16"]
8887
codegen-backend = "cranelift"
8988
debug = "line-tables-only"
9089
debug-assertions = true
@@ -93,6 +92,7 @@ strip = "none" # true | false | "none" | "symbols" | "deb
9392
panic = "abort" # "unwind" | "abort"
9493
lto = "off" # "false" ### # true | false | "off" | "thin" | "fat" ## Can't use with cranelift yet
9594
trim-paths = "none"
95+
# rustflags = ["-Zthreads=16"]
9696
# tune-cpu = "native"
9797

9898
######################################################################################################################################################
@@ -101,15 +101,15 @@ trim-paths = "none"
101101
opt-level = 3
102102
codegen-units = 1
103103
incremental = false
104-
rustflags = ["-Zthreads=16"]
105-
codegen-backend = "cranelift" # May break deps.
104+
codegen-backend = "cranelift" # May break deps.
106105
debug = "none"
107106
debug-assertions = false
108-
overflow-checks = false # debatable
109-
strip = "symbols" # true | false | "none" | "symbols" | "debuginfo" ## Leave off @ w. THIS IS NOT OBFUSCATION.
107+
overflow-checks = false # debatable
108+
strip = "symbols" # true | false | "none" | "symbols" | "debuginfo" ## Leave off @ w. THIS IS NOT OBFUSCATION.
110109
panic = "unwind"
111-
lto = "off" # true | false | "off" | "thin" | "fat" ## Can't use with cranelift yet
112-
trim-paths = ["diagnostics", "object"]
110+
lto = "off" # true | false | "off" | "thin" | "fat" ## Can't use with cranelift yet
111+
trim-paths = [ "diagnostics", "object" ]
112+
# rustflags = ["-Zthreads=16"]
113113
# tune-cpu = "native"
114114

115115

src/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// in-crate result type
2+
pub type Result<T> = std::result::Result<T, Error>;
3+
14
#[derive(thiserror::Error, Debug)]
25
pub enum Error {
36
#[error("Generic error handler: {0}")]

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod error;
22
mod prelude;
33

4-
pub use self::prelude::{Error, Result, W};
4+
pub use crate::error::{Error, Result};
55

66
fn main() -> Result<()> {
77
println!("Hello, world!");

src/prelude.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
// in-crate Error type
2-
pub use crate::error::Error;
2+
pub use crate::error::{Error, Result};
33

44
// pub use tracing::{debug, error, info, warn};
55

6-
// in-crate result type
7-
pub type Result<T> = std::result::Result<T, Error>;
8-
96
// Wrapper struct
107
#[allow(dead_code)]
118
pub struct W<T>(pub T);

0 commit comments

Comments
 (0)