Skip to content
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

doc: more doc comments and intra-doc links #11703

Merged
merged 7 commits into from
Feb 12, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/cargo/core/compiler/output_depinfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ use log::debug;

/// Bacially just normalizes a given path and converts it to a string.
fn render_filename<P: AsRef<Path>>(path: P, basedir: Option<&str>) -> CargoResult<String> {
fn wrap_path(path: &Path) -> CargoResult<String> {
Comment on lines 15 to +16
Copy link
Contributor

Choose a reason for hiding this comment

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

Whats gained by doing this? Personally, I avoid inner functions unless I'm doing it for generics.

Copy link
Member Author

Choose a reason for hiding this comment

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

One less item to show in the list of functions in rustdoc? But you're right not many gains.

Copy link
Contributor

Choose a reason for hiding this comment

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

Generally, when doing something to make things nicer for a tool, it makes me question the tool and not the code

Of course there are exceptions, like us wanting to use the auto-labeling as feedback on code organization

path.to_str()
.ok_or_else(|| internal(format!("path `{:?}` not utf-8", path)))
.map(|f| f.replace(" ", "\\ "))
}

let path = path.as_ref();
if let Some(basedir) = basedir {
let norm_path = normalize_path(path);
Expand All @@ -26,12 +32,6 @@ fn render_filename<P: AsRef<Path>>(path: P, basedir: Option<&str>) -> CargoResul
}
}

fn wrap_path(path: &Path) -> CargoResult<String> {
path.to_str()
.ok_or_else(|| internal(format!("path `{:?}` not utf-8", path)))
.map(|f| f.replace(" ", "\\ "))
}

/// Collects all dependencies of the `unit` for the output dep info file.
///
/// Dependencies will be stored in `deps`, including:
Expand Down