Index of the comment nearest the item, above its Rust attributes, or -1. */
| 2117 | |
| 2118 | /* Index of the comment nearest the item, above its Rust attributes, or -1. */ |
| 2119 | static int doc_nearest_comment(const doc_trivia_t *t) { |
| 2120 | int k = t->count - SKIP_ONE; |
| 2121 | while (k >= 0 && t->items[k].kind == DOC_SPAN_ATTR) { |
| 2122 | k--; |
| 2123 | } |
| 2124 | return (k >= 0 && t->items[k].kind == DOC_SPAN_COMMENT) ? k : CBM_NOT_FOUND; |
| 2125 | } |
| 2126 | |
| 2127 | /* A nearer plain comment does not hide a doc-style comment directly above it |
| 2128 | * (a javadoc, then `// NOSONAR`): the index of that doc comment, else `near`. */ |