Skip to content

Commit

Permalink
Automatic deploy to GitHub Pages: ddbe110
Browse files Browse the repository at this point in the history
  • Loading branch information
GHA CI committed Sep 20, 2023
1 parent 8742969 commit b02cb35
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion master/lints.json
Original file line number Diff line number Diff line change
Expand Up @@ -9098,7 +9098,7 @@
},
"group": "restriction",
"level": "allow",
"docs": "\n### What it does\nChecks for `unsafe` blocks and impls without a `// SAFETY: ` comment\nexplaining why the unsafe operations performed inside\nthe block are safe.\n\nNote the comment must appear on the line(s) preceding the unsafe block\nwith nothing appearing in between. The following is ok:\n```rust\nfoo(\n // SAFETY:\n // This is a valid safety comment\n unsafe { *x }\n)\n```\nBut neither of these are:\n```rust\n// SAFETY:\n// This is not a valid safety comment\nfoo(\n /* SAFETY: Neither is this */ unsafe { *x },\n);\n```\n\n### Why is this bad?\nUndocumented unsafe blocks and impls can make it difficult to\nread and maintain code, as well as uncover unsoundness\nand bugs.\n\n### Example\n```rust\nuse std::ptr::NonNull;\nlet a = &mut 42;\n\nlet ptr = unsafe { NonNull::new_unchecked(a) };\n```\nUse instead:\n```rust\nuse std::ptr::NonNull;\nlet a = &mut 42;\n\n// SAFETY: references are guaranteed to be non-null.\nlet ptr = unsafe { NonNull::new_unchecked(a) };\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `accept-comment-above-statement`: `bool`(defaults to `false`): Whether to accept a safety comment to be placed above the statement containing the `unsafe` block\n* `accept-comment-above-attributes`: `bool`(defaults to `false`): Whether to accept a safety comment to be placed above the attributes for the `unsafe` block\n",
"docs": "\n### What it does\nChecks for `unsafe` blocks and impls without a `// SAFETY: ` comment\nexplaining why the unsafe operations performed inside\nthe block are safe.\n\nNote the comment must appear on the line(s) preceding the unsafe block\nwith nothing appearing in between. The following is ok:\n```rust\nfoo(\n // SAFETY:\n // This is a valid safety comment\n unsafe { *x }\n)\n```\nBut neither of these are:\n```rust\n// SAFETY:\n// This is not a valid safety comment\nfoo(\n /* SAFETY: Neither is this */ unsafe { *x },\n);\n```\n\n### Why is this bad?\nUndocumented unsafe blocks and impls can make it difficult to\nread and maintain code, as well as uncover unsoundness\nand bugs.\n\n### Example\n```rust\nuse std::ptr::NonNull;\nlet a = &mut 42;\n\nlet ptr = unsafe { NonNull::new_unchecked(a) };\n```\nUse instead:\n```rust\nuse std::ptr::NonNull;\nlet a = &mut 42;\n\n// SAFETY: references are guaranteed to be non-null.\nlet ptr = unsafe { NonNull::new_unchecked(a) };\n```\n\n### Configuration\nThis lint has the following configuration variables:\n\n* `accept-comment-above-statement`: `bool`(defaults to `true`): Whether to accept a safety comment to be placed above the statement containing the `unsafe` block\n* `accept-comment-above-attributes`: `bool`(defaults to `true`): Whether to accept a safety comment to be placed above the attributes for the `unsafe` block\n",
"version": "1.58.0",
"applicability": {
"is_multi_part_suggestion": false,
Expand Down

0 comments on commit b02cb35

Please sign in to comment.