Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

public API naming and shape decisions drift without a referenced style guide

未关闭 适合新手
#1,155 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 3 天内回复

还没有人认领这个 Issue。

评估

难度
1/5
预计耗时
1 小时以内
新手友好度
86/100
Issue 类型
文档
描述清晰度
描述清楚
活跃度
冷清
技术栈
rust
领域
documentation

调研方向

打开 CONTRIBUTING.md,并确认它只涉及现有的代码风格和仓库模式。添加对官方 Rust API Guidelines 的引用,将其作为公共 API 命名和类型形状的基准,但不要更改现有 API。完成的标准是,贡献者文档明确链接到该指南及其相关检查清单,同时 API 对齐仍不在范围内。

由索引模型根据 Issue 内容生成。

描述

P3 question Stale T-documentation T-enhancement

Description

While looking through the crate's public API, I noticed a few inconsistencies that suggest there's no referenced style-guide baseline behind naming/type-shape decisions:

  • Some plain accessors use a get_ prefix while neighboring accessors in the same files don't, which reads as inconsistent with the Rust API Guidelines' C-GETTER convention.
  • Identifier fields (session/task/tool-use/client id) are represented as bare String/Arc<str> rather than distinct types, so nothing stops one id kind being passed where another is expected.

No repo doc references a style guide, so it's unclear whether this is intentional or just drift. Simplest fix: state explicitly in contributor docs that code should be idiomatic and follow the official Rust API Guidelines (https://rust-lang.github.io/api-guidelines/) - its naming (C-*) and type-safety (C-NEWTYPE) checklists already cover both examples above, so this is a documentation change, not a new process to design. Bringing existing API (like the two examples above) in line with the referenced guide is a separate, breaking-change follow-up - worth tracking on its own once the guide itself is adopted, not part of this issue.

Reproduction Steps

  1. rg -n "pub fn get_[a-z_]+\(" crates/rmcp/src - 8 matches, all plain field/derived-value accessors inconsistent with sibling accessors in the same files.
  2. Compare SessionId/EventId/StreamId/task_id/tool_use_id/client_id field types across model.rs, task_manager.rs, transport/auth.rs - all bare String/Arc<str>/type aliases, no newtype.
  3. Checked CONTRIBUTING.md and the repo for any reference to language-specific style guide - none found. CONTRIBUTING.md only says "follow existing code style" / "follow the repository's established patterns," with no concrete convention to check against.

Expected Behavior

Contributor docs cite an explicit style-guide baseline for public API naming/shape.

Actual Behavior

No such reference exists, so it's unclear whether naming inconsistencies like the above are intentional.

Logs / Evidence

主要语言
Rust
星标
4k
派生
662
平均合并
3 天 23 小时
30 天内合并 PR
34

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/rust-sdk 的其他 Issue

查看 modelcontextprotocol/rust-sdk 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。