Skip to content

Add warn(missing_docs) lint and fix all instances of it #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 16 commits into from
Jun 29, 2025

Conversation

brannondorsey
Copy link
Contributor

@brannondorsey brannondorsey commented Jun 21, 2025

Summary

Adds the following lint to Cargo.toml and corrects all cases of it.

[lints.rust]
missing_docs = "warn"

Checklist

  • Tests pass locally
  • Documentation updated if needed
  • I need to fix the warnings in src/generated encountered via CI (example).

Comment on lines +25 to +26
[lints.rust]
missing_docs = "warn"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was stabilized in v1.74 (docs).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is the correct link: https://doc.rust-lang.org/1.74.0/cargo/reference/unstable.html#lints

I can't find much docs on missing_docs, only found it's mentioned by the rustdoc tool: https://doc.rust-lang.org/rustdoc/write-documentation/what-to-include.html
However, it seems obvious what it does.

Comment on lines -42 to +44
protos.sort_by(|a, b| a.cmp(b));
protos.sort();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A no-op suggested by Clippy.

build.rs Outdated
Comment on lines 65 to 70
config.type_attribute(".", "#[allow(clippy::doc_lazy_continuation)]");
config.type_attribute(".", "#[allow(clippy::empty_docs)]");
}

config.type_attribute(".", "#[allow(clippy::doc_lazy_continuation)]");
config.type_attribute(".", "#[allow(clippy::empty_docs)]");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two are moved out of the serde block because I think they were placed behind that feature gate by mistake. A second pair of eyes to confirm this understanding would be helpful.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up putting these back in ccc47d5. I still think they may be incorrectly hidden behind the serde feature, but am leaving that unchanged in this PR unless someone can confirm.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In #54 they were successfully used without serde.

Comment on lines -161 to +167
pub use crate::connections::wrappers::NodeId;

pub use crate::connections::wrappers::mesh_channel::MeshChannel;

pub use crate::connections::wrappers::encoded_data::EncodedMeshPacketData;
pub use crate::connections::wrappers::encoded_data::EncodedToRadioPacket;
pub use crate::connections::wrappers::encoded_data::EncodedToRadioPacketWithHeader;
pub use crate::connections::wrappers::encoded_data::IncomingStreamData;
pub use crate::connections::wrappers::mesh_channel::MeshChannel;
pub use crate::connections::wrappers::NodeId;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A minor formatting fix.

@@ -1,3 +1,4 @@
//! A Rust library for communicating with and configuring Meshtastic devices.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pulled this module-level doc from the crate description.

Comment on lines +42 to +44
/// NOTE: This error name is misspelled and should be treated as if it is `InvalidDataSize`.
#[error("Trying to send too much data")]
InvalidaDataSize { data_length: usize },
InvalidaDataSize {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unfortunate, but changing this value from InvalidaDataSize to InvalidDataSize would be a breaking change. We could either...

  1. Do nothing (as I have done here)
  2. Fix this and publish v1.7.0, introducing an insanely easy to fix breaking change in a minor version bump.
  3. Wait until a v2.0.0 goes out and include that change there

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixing a typo should not be a big deal, for sure we shouldn't wait for v2.0.0.

I'd like to make a new release in July, let's fix this and publish 1.7.0.

@lukipuki lukipuki merged commit c3d2816 into meshtastic:main Jun 29, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants