Skip to content

Commit

Permalink
Removed unnecessary hashes in string literals (#390)
Browse files Browse the repository at this point in the history
  • Loading branch information
CraZySacX authored Dec 10, 2024
1 parent e242196 commit 53b8e63
Show file tree
Hide file tree
Showing 9 changed files with 156 additions and 192 deletions.
4 changes: 2 additions & 2 deletions test_util/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
//!
#![cfg_attr(
feature = "repo",
doc = r##"## `vergen` - Test git repositories (`repo` feature)
doc = r"## `vergen` - Test git repositories (`repo` feature)
If you enable the `repo` feature of `test_util` you can also use
the [`TestRepos`] struct to creat temporary git repositories useful for `vergen-gi*` testing
Expand All @@ -65,7 +65,7 @@ the [`TestRepos`] struct to creat temporary git repositories useful for `vergen-
# Ok(())
# }
```
"##
"
)]
// rustc lints
#![cfg_attr(
Expand Down
75 changes: 33 additions & 42 deletions vergen-git2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,44 +60,35 @@
//! ```
//! # use anyhow::Result;
//! # use vergen_git2::{Emitter, Git2Builder};
#![cfg_attr(feature = "build", doc = r##"# use vergen_git2::BuildBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use vergen_git2::CargoBuilder;"##)]
#![cfg_attr(feature = "rustc", doc = r##"# use vergen_git2::RustcBuilder;"##)]
#![cfg_attr(feature = "si", doc = r##"# use vergen_git2::SysinfoBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use test_util::with_cargo_vars;"##)]
#![cfg_attr(feature = "build", doc = r"# use vergen_git2::BuildBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use vergen_git2::CargoBuilder;")]
#![cfg_attr(feature = "rustc", doc = r"# use vergen_git2::RustcBuilder;")]
#![cfg_attr(feature = "si", doc = r"# use vergen_git2::SysinfoBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use test_util::with_cargo_vars;")]
//! #
//! # pub fn main() -> Result<()> {
#![cfg_attr(feature = "cargo", doc = r##"# let result = with_cargo_vars(|| {"##)]
#![cfg_attr(feature = "cargo", doc = r"# let result = with_cargo_vars(|| {")]
//! // NOTE: This will output everything, and requires all features enabled.
//! // NOTE: See the specific builder documentation for configuration options.
#![cfg_attr(
feature = "build",
doc = r##"let build = BuildBuilder::all_build()?;"##
)]
#![cfg_attr(
feature = "cargo",
doc = r##"let cargo = CargoBuilder::all_cargo()?;"##
)]
#![cfg_attr(feature = "build", doc = r"let build = BuildBuilder::all_build()?;")]
#![cfg_attr(feature = "cargo", doc = r"let cargo = CargoBuilder::all_cargo()?;")]
//! let git2 = Git2Builder::all_git()?;
#![cfg_attr(
feature = "rustc",
doc = r##"let rustc = RustcBuilder::all_rustc()?;"##
)]
#![cfg_attr(feature = "si", doc = r##"let si = SysinfoBuilder::all_sysinfo()?;"##)]
#![cfg_attr(feature = "rustc", doc = r"let rustc = RustcBuilder::all_rustc()?;")]
#![cfg_attr(feature = "si", doc = r"let si = SysinfoBuilder::all_sysinfo()?;")]
//!
//! Emitter::default()
#![cfg_attr(feature = "build", doc = r##" .add_instructions(&build)?"##)]
#![cfg_attr(feature = "cargo", doc = r##" .add_instructions(&cargo)?"##)]
#![cfg_attr(feature = "build", doc = r" .add_instructions(&build)?")]
#![cfg_attr(feature = "cargo", doc = r" .add_instructions(&cargo)?")]
//! .add_instructions(&git2)?
#![cfg_attr(feature = "rustc", doc = r##" .add_instructions(&rustc)?"##)]
#![cfg_attr(feature = "si", doc = r##" .add_instructions(&si)?"##)]
#![cfg_attr(feature = "rustc", doc = r" .add_instructions(&rustc)?")]
#![cfg_attr(feature = "si", doc = r" .add_instructions(&si)?")]
//! .emit()?;
#![cfg_attr(
feature = "cargo",
doc = r##"
doc = r"
# Ok(())
# });
# assert!(result.is_ok());"##
# assert!(result.is_ok());"
)]
//! # Ok(())
//! # }
Expand Down Expand Up @@ -147,47 +138,47 @@
//! ```
//! # use anyhow::Result;
//! # use vergen_git2::{Emitter, Git2Builder};
#![cfg_attr(feature = "build", doc = r##"# use vergen_git2::BuildBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use vergen_git2::CargoBuilder;"##)]
#![cfg_attr(feature = "rustc", doc = r##"# use vergen_git2::RustcBuilder;"##)]
#![cfg_attr(feature = "si", doc = r##"# use vergen_git2::SysinfoBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use test_util::with_cargo_vars;"##)]
#![cfg_attr(feature = "build", doc = r"# use vergen_git2::BuildBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use vergen_git2::CargoBuilder;")]
#![cfg_attr(feature = "rustc", doc = r"# use vergen_git2::RustcBuilder;")]
#![cfg_attr(feature = "si", doc = r"# use vergen_git2::SysinfoBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use test_util::with_cargo_vars;")]
//! #
//! # pub fn main() -> Result<()> {
#![cfg_attr(feature = "cargo", doc = r##"# let result = with_cargo_vars(|| {"##)]
#![cfg_attr(feature = "cargo", doc = r"# let result = with_cargo_vars(|| {")]
#![cfg_attr(
feature = "build",
doc = r##"// NOTE: This will output only the instructions specified.
doc = r"// NOTE: This will output only the instructions specified.
// NOTE: See the specific builder documentation for configuration options.
let build = BuildBuilder::default().build_timestamp(true).build()?;"##
let build = BuildBuilder::default().build_timestamp(true).build()?;"
)]
#![cfg_attr(
feature = "cargo",
doc = r##"let cargo = CargoBuilder::default().opt_level(true).build()?;"##
doc = r"let cargo = CargoBuilder::default().opt_level(true).build()?;"
)]
//! let git2 = Git2Builder::default().commit_timestamp(true).build()?;
#![cfg_attr(
feature = "rustc",
doc = r##"let rustc = RustcBuilder::default().semver(true).build()?;"##
doc = r"let rustc = RustcBuilder::default().semver(true).build()?;"
)]
#![cfg_attr(
feature = "si",
doc = r##"let si = SysinfoBuilder::default().cpu_core_count(true).build()?;"##
doc = r"let si = SysinfoBuilder::default().cpu_core_count(true).build()?;"
)]
//!
//! Emitter::default()
#![cfg_attr(feature = "build", doc = r##" .add_instructions(&build)?"##)]
#![cfg_attr(feature = "cargo", doc = r##" .add_instructions(&cargo)?"##)]
#![cfg_attr(feature = "build", doc = r" .add_instructions(&build)?")]
#![cfg_attr(feature = "cargo", doc = r" .add_instructions(&cargo)?")]
//! .add_instructions(&git2)?
#![cfg_attr(feature = "rustc", doc = r##" .add_instructions(&rustc)?"##)]
#![cfg_attr(feature = "si", doc = r##" .add_instructions(&si)?"##)]
#![cfg_attr(feature = "rustc", doc = r" .add_instructions(&rustc)?")]
#![cfg_attr(feature = "si", doc = r" .add_instructions(&si)?")]
//! .emit()?;
#![cfg_attr(
feature = "cargo",
doc = r##"
doc = r"
# Ok(())
# });
# assert!(result.is_ok());"##
# assert!(result.is_ok());"
)]
//! # Ok(())
//! # }
Expand Down
75 changes: 33 additions & 42 deletions vergen-gitcl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,44 +60,35 @@
//! ```
//! # use anyhow::Result;
//! # use vergen_gitcl::{Emitter, GitclBuilder};
#![cfg_attr(feature = "build", doc = r##"# use vergen_gitcl::BuildBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use vergen_gitcl::CargoBuilder;"##)]
#![cfg_attr(feature = "rustc", doc = r##"# use vergen_gitcl::RustcBuilder;"##)]
#![cfg_attr(feature = "si", doc = r##"# use vergen_gitcl::SysinfoBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use test_util::with_cargo_vars;"##)]
#![cfg_attr(feature = "build", doc = r"# use vergen_gitcl::BuildBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use vergen_gitcl::CargoBuilder;")]
#![cfg_attr(feature = "rustc", doc = r"# use vergen_gitcl::RustcBuilder;")]
#![cfg_attr(feature = "si", doc = r"# use vergen_gitcl::SysinfoBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use test_util::with_cargo_vars;")]
//! #
//! # pub fn main() -> Result<()> {
#![cfg_attr(feature = "cargo", doc = r##"# let result = with_cargo_vars(|| {"##)]
#![cfg_attr(feature = "cargo", doc = r"# let result = with_cargo_vars(|| {")]
//! // NOTE: This will output everything, and requires all features enabled.
//! // NOTE: See the specific builder documentation for configuration options.
#![cfg_attr(
feature = "build",
doc = r##"let build = BuildBuilder::all_build()?;"##
)]
#![cfg_attr(
feature = "cargo",
doc = r##"let cargo = CargoBuilder::all_cargo()?;"##
)]
#![cfg_attr(feature = "build", doc = r"let build = BuildBuilder::all_build()?;")]
#![cfg_attr(feature = "cargo", doc = r"let cargo = CargoBuilder::all_cargo()?;")]
//! let gitcl = GitclBuilder::all_git()?;
#![cfg_attr(
feature = "rustc",
doc = r##"let rustc = RustcBuilder::all_rustc()?;"##
)]
#![cfg_attr(feature = "si", doc = r##"let si = SysinfoBuilder::all_sysinfo()?;"##)]
#![cfg_attr(feature = "rustc", doc = r"let rustc = RustcBuilder::all_rustc()?;")]
#![cfg_attr(feature = "si", doc = r"let si = SysinfoBuilder::all_sysinfo()?;")]
//!
//! Emitter::default()
#![cfg_attr(feature = "build", doc = r##" .add_instructions(&build)?"##)]
#![cfg_attr(feature = "cargo", doc = r##" .add_instructions(&cargo)?"##)]
#![cfg_attr(feature = "build", doc = r" .add_instructions(&build)?")]
#![cfg_attr(feature = "cargo", doc = r" .add_instructions(&cargo)?")]
//! .add_instructions(&gitcl)?
#![cfg_attr(feature = "rustc", doc = r##" .add_instructions(&rustc)?"##)]
#![cfg_attr(feature = "si", doc = r##" .add_instructions(&si)?"##)]
#![cfg_attr(feature = "rustc", doc = r" .add_instructions(&rustc)?")]
#![cfg_attr(feature = "si", doc = r" .add_instructions(&si)?")]
//! .emit()?;
#![cfg_attr(
feature = "cargo",
doc = r##"
doc = r"
# Ok(())
# });
# assert!(result.is_ok());"##
# assert!(result.is_ok());"
)]
//! # Ok(())
//! # }
Expand Down Expand Up @@ -147,47 +138,47 @@
//! ```
//! # use anyhow::Result;
//! # use vergen_gitcl::{Emitter, GitclBuilder};
#![cfg_attr(feature = "build", doc = r##"# use vergen_gitcl::BuildBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use vergen_gitcl::CargoBuilder;"##)]
#![cfg_attr(feature = "rustc", doc = r##"# use vergen_gitcl::RustcBuilder;"##)]
#![cfg_attr(feature = "si", doc = r##"# use vergen_gitcl::SysinfoBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use test_util::with_cargo_vars;"##)]
#![cfg_attr(feature = "build", doc = r"# use vergen_gitcl::BuildBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use vergen_gitcl::CargoBuilder;")]
#![cfg_attr(feature = "rustc", doc = r"# use vergen_gitcl::RustcBuilder;")]
#![cfg_attr(feature = "si", doc = r"# use vergen_gitcl::SysinfoBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use test_util::with_cargo_vars;")]
//! #
//! # pub fn main() -> Result<()> {
#![cfg_attr(feature = "cargo", doc = r##"# let result = with_cargo_vars(|| {"##)]
#![cfg_attr(feature = "cargo", doc = r"# let result = with_cargo_vars(|| {")]
#![cfg_attr(
feature = "build",
doc = r##"// NOTE: This will output only the instructions specified.
doc = r"// NOTE: This will output only the instructions specified.
// NOTE: See the specific builder documentation for configuration options.
let build = BuildBuilder::default().build_timestamp(true).build()?;"##
let build = BuildBuilder::default().build_timestamp(true).build()?;"
)]
#![cfg_attr(
feature = "cargo",
doc = r##"let cargo = CargoBuilder::default().opt_level(true).build()?;"##
doc = r"let cargo = CargoBuilder::default().opt_level(true).build()?;"
)]
//! let gitcl = GitclBuilder::default().commit_timestamp(true).build()?;
#![cfg_attr(
feature = "rustc",
doc = r##"let rustc = RustcBuilder::default().semver(true).build()?;"##
doc = r"let rustc = RustcBuilder::default().semver(true).build()?;"
)]
#![cfg_attr(
feature = "si",
doc = r##"let si = SysinfoBuilder::default().cpu_core_count(true).build()?;"##
doc = r"let si = SysinfoBuilder::default().cpu_core_count(true).build()?;"
)]
//!
//! Emitter::default()
#![cfg_attr(feature = "build", doc = r##" .add_instructions(&build)?"##)]
#![cfg_attr(feature = "cargo", doc = r##" .add_instructions(&cargo)?"##)]
#![cfg_attr(feature = "build", doc = r" .add_instructions(&build)?")]
#![cfg_attr(feature = "cargo", doc = r" .add_instructions(&cargo)?")]
//! .add_instructions(&gitcl)?
#![cfg_attr(feature = "rustc", doc = r##" .add_instructions(&rustc)?"##)]
#![cfg_attr(feature = "si", doc = r##" .add_instructions(&si)?"##)]
#![cfg_attr(feature = "rustc", doc = r" .add_instructions(&rustc)?")]
#![cfg_attr(feature = "si", doc = r" .add_instructions(&si)?")]
//! .emit()?;
#![cfg_attr(
feature = "cargo",
doc = r##"
doc = r"
# Ok(())
# });
# assert!(result.is_ok());"##
# assert!(result.is_ok());"
)]
//! # Ok(())
//! # }
Expand Down
75 changes: 33 additions & 42 deletions vergen-gix/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,44 +60,35 @@
//! ```
//! # use anyhow::Result;
//! # use vergen_gix::{Emitter, GixBuilder};
#![cfg_attr(feature = "build", doc = r##"# use vergen_gix::BuildBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use vergen_gix::CargoBuilder;"##)]
#![cfg_attr(feature = "rustc", doc = r##"# use vergen_gix::RustcBuilder;"##)]
#![cfg_attr(feature = "si", doc = r##"# use vergen_gix::SysinfoBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use test_util::with_cargo_vars;"##)]
#![cfg_attr(feature = "build", doc = r"# use vergen_gix::BuildBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use vergen_gix::CargoBuilder;")]
#![cfg_attr(feature = "rustc", doc = r"# use vergen_gix::RustcBuilder;")]
#![cfg_attr(feature = "si", doc = r"# use vergen_gix::SysinfoBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use test_util::with_cargo_vars;")]
//! #
//! # pub fn main() -> Result<()> {
#![cfg_attr(feature = "cargo", doc = r##"# let result = with_cargo_vars(|| {"##)]
#![cfg_attr(feature = "cargo", doc = r"# let result = with_cargo_vars(|| {")]
//! // NOTE: This will output everything, and requires all features enabled.
//! // NOTE: See the specific builder documentation for configuration options.
#![cfg_attr(
feature = "build",
doc = r##"let build = BuildBuilder::all_build()?;"##
)]
#![cfg_attr(
feature = "cargo",
doc = r##"let cargo = CargoBuilder::all_cargo()?;"##
)]
#![cfg_attr(feature = "build", doc = r"let build = BuildBuilder::all_build()?;")]
#![cfg_attr(feature = "cargo", doc = r"let cargo = CargoBuilder::all_cargo()?;")]
//! let gitcl = GixBuilder::all_git()?;
#![cfg_attr(
feature = "rustc",
doc = r##"let rustc = RustcBuilder::all_rustc()?;"##
)]
#![cfg_attr(feature = "si", doc = r##"let si = SysinfoBuilder::all_sysinfo()?;"##)]
#![cfg_attr(feature = "rustc", doc = r"let rustc = RustcBuilder::all_rustc()?;")]
#![cfg_attr(feature = "si", doc = r"let si = SysinfoBuilder::all_sysinfo()?;")]
//!
//! Emitter::default()
#![cfg_attr(feature = "build", doc = r##" .add_instructions(&build)?"##)]
#![cfg_attr(feature = "cargo", doc = r##" .add_instructions(&cargo)?"##)]
#![cfg_attr(feature = "build", doc = r" .add_instructions(&build)?")]
#![cfg_attr(feature = "cargo", doc = r" .add_instructions(&cargo)?")]
//! .add_instructions(&gitcl)?
#![cfg_attr(feature = "rustc", doc = r##" .add_instructions(&rustc)?"##)]
#![cfg_attr(feature = "si", doc = r##" .add_instructions(&si)?"##)]
#![cfg_attr(feature = "rustc", doc = r" .add_instructions(&rustc)?")]
#![cfg_attr(feature = "si", doc = r" .add_instructions(&si)?")]
//! .emit()?;
#![cfg_attr(
feature = "cargo",
doc = r##"
doc = r"
# Ok(())
# });
# assert!(result.is_ok());"##
# assert!(result.is_ok());"
)]
//! # Ok(())
//! # }
Expand Down Expand Up @@ -147,47 +138,47 @@
//! ```
//! # use anyhow::Result;
//! # use vergen_gix::{Emitter, GixBuilder};
#![cfg_attr(feature = "build", doc = r##"# use vergen_gix::BuildBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use vergen_gix::CargoBuilder;"##)]
#![cfg_attr(feature = "rustc", doc = r##"# use vergen_gix::RustcBuilder;"##)]
#![cfg_attr(feature = "si", doc = r##"# use vergen_gix::SysinfoBuilder;"##)]
#![cfg_attr(feature = "cargo", doc = r##"# use test_util::with_cargo_vars;"##)]
#![cfg_attr(feature = "build", doc = r"# use vergen_gix::BuildBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use vergen_gix::CargoBuilder;")]
#![cfg_attr(feature = "rustc", doc = r"# use vergen_gix::RustcBuilder;")]
#![cfg_attr(feature = "si", doc = r"# use vergen_gix::SysinfoBuilder;")]
#![cfg_attr(feature = "cargo", doc = r"# use test_util::with_cargo_vars;")]
//! #
//! # pub fn main() -> Result<()> {
#![cfg_attr(feature = "cargo", doc = r##"# let result = with_cargo_vars(|| {"##)]
#![cfg_attr(feature = "cargo", doc = r"# let result = with_cargo_vars(|| {")]
#![cfg_attr(
feature = "build",
doc = r##"// NOTE: This will output only the instructions specified.
doc = r"// NOTE: This will output only the instructions specified.
// NOTE: See the specific builder documentation for configuration options.
let build = BuildBuilder::default().build_timestamp(true).build()?;"##
let build = BuildBuilder::default().build_timestamp(true).build()?;"
)]
#![cfg_attr(
feature = "cargo",
doc = r##"let cargo = CargoBuilder::default().opt_level(true).build()?;"##
doc = r"let cargo = CargoBuilder::default().opt_level(true).build()?;"
)]
//! let gitcl = GixBuilder::default().commit_timestamp(true).build()?;
#![cfg_attr(
feature = "rustc",
doc = r##"let rustc = RustcBuilder::default().semver(true).build()?;"##
doc = r"let rustc = RustcBuilder::default().semver(true).build()?;"
)]
#![cfg_attr(
feature = "si",
doc = r##"let si = SysinfoBuilder::default().cpu_core_count(true).build()?;"##
doc = r"let si = SysinfoBuilder::default().cpu_core_count(true).build()?;"
)]
//!
//! Emitter::default()
#![cfg_attr(feature = "build", doc = r##" .add_instructions(&build)?"##)]
#![cfg_attr(feature = "cargo", doc = r##" .add_instructions(&cargo)?"##)]
#![cfg_attr(feature = "build", doc = r" .add_instructions(&build)?")]
#![cfg_attr(feature = "cargo", doc = r" .add_instructions(&cargo)?")]
//! .add_instructions(&gitcl)?
#![cfg_attr(feature = "rustc", doc = r##" .add_instructions(&rustc)?"##)]
#![cfg_attr(feature = "si", doc = r##" .add_instructions(&si)?"##)]
#![cfg_attr(feature = "rustc", doc = r" .add_instructions(&rustc)?")]
#![cfg_attr(feature = "si", doc = r" .add_instructions(&si)?")]
//! .emit()?;
#![cfg_attr(
feature = "cargo",
doc = r##"
doc = r"
# Ok(())
# });
# assert!(result.is_ok());"##
# assert!(result.is_ok());"
)]
//! # Ok(())
//! # }
Expand Down
Loading

0 comments on commit 53b8e63

Please sign in to comment.