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

Escape square brackets when they're not references #209

Merged
merged 2 commits into from
Aug 24, 2018

Conversation

joar
Copy link
Contributor

@joar joar commented Aug 24, 2018

This fixes warnings like

warning: `[key]` cannot be resolved, ignoring it...
   --> pyo3/src/objectprotocol.rs:155:63
    |
155 |     /// This is equivalent to the Python expression 'del self[key]'.
    |                                                               ^^^ cannot be resolved, ignoring
    |
    = help: to escape `[` and `]` characters, just add '\' before them like `\[` or `\]`

when running cargo doc using cargo 1.29.0-nightly (6a7672ef5 2018-08-14) on a crate with pyo3 as a dependency.

@joar joar changed the title Escape square brackets in references. Escape square brackets when they're not references Aug 24, 2018
@joar
Copy link
Contributor Author

joar commented Aug 24, 2018

This could be a bug in cargo though:

  • Some of the fixed warnings were caused by square brackets in Python code examples and could be fixed by surrounding Python code examples with backticks
  • Some lines already had backticks and required escaping the square brackets inside the backticks in order to silence the warnings.

@joar
Copy link
Contributor Author

joar commented Aug 24, 2018

Never mind, the issue is actually that some of the code examples are not surrounded by backticks, but with single quotes. I'll switch those places to using backticks in order to avoid cluttering with backslash in the docstring.

The backticks properly monospace the Python expressions in the rendered
docs, and also escape square brackets inside so that rustdoc isn't
trying to parse them as references.
@konstin
Copy link
Member

konstin commented Aug 24, 2018

Thank you!

@konstin konstin merged commit 33e72a2 into PyO3:master Aug 24, 2018
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