Skip to content

Commit 93c2991

Browse files
Fix doc link and make CI lints stricter (#272)
* cstr16: fix rustdoc warning in as_str_in_buf docstring * ci: run "cargo doc" and treat warnings as errors This can catch some issues like broken links in docstrings. * ci: treat clippy warnings as errors This makes the CI actually fail instead of just putting warning annotations in the source. * ci: enable more features in tests For clippy and rustdoc, add `--all-features` to cover more code. For `cargo test`, enable just the `exts` feature (the `alloc` and `logger` features can't be enabled because we're not running under UEFI here).
1 parent 4811cab commit 93c2991

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.github/workflows/rust.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
CARGO_PROFILE_DEV_PANIC: unwind
8686
with:
8787
command: test
88-
args: -Zbuild-std=std --target x86_64-unknown-linux-gnu
88+
args: -Zbuild-std=std --target x86_64-unknown-linux-gnu --features=exts
8989

9090
lints:
9191
name: Lints
@@ -112,4 +112,12 @@ jobs:
112112
uses: actions-rs/cargo@v1
113113
with:
114114
command: clippy
115-
args: --target x86_64-unknown-uefi
115+
args: --target x86_64-unknown-uefi --all-features -- -Dwarnings
116+
117+
- name: Run cargo doc
118+
uses: actions-rs/cargo@v1
119+
env:
120+
RUSTDOCFLAGS: -Dwarnings
121+
with:
122+
command: doc
123+
args: --target x86_64-unknown-uefi --all-features

src/data_types/strs.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ impl CStr16 {
167167

168168
/// Writes each [`Char16`] as a [´char´] (4 bytes long in Rust language) into the buffer.
169169
/// It is up the the implementer of [`core::fmt::Write`] to convert the char to a string
170-
/// with proper encoding/charset. For example, in the case of [`core::alloc::string::String`]
170+
/// with proper encoding/charset. For example, in the case of [`alloc::string::String`]
171171
/// all Rust chars (UTF-32) get converted to UTF-8.
172172
///
173173
/// ## Example
@@ -179,6 +179,8 @@ impl CStr16 {
179179
/// firmware_vendor_c16_str.as_str_in_buf(&mut buf);
180180
/// log::info!("as rust str: {}", buf.as_str());
181181
/// ```
182+
///
183+
/// [`alloc::string::String`]: https://doc.rust-lang.org/nightly/alloc/string/struct.String.html
182184
pub fn as_str_in_buf(&self, buf: &mut dyn core::fmt::Write) -> core::fmt::Result {
183185
for c16 in self.iter() {
184186
buf.write_char(char::from(*c16))?;

0 commit comments

Comments
 (0)