blob: 8fe9d0babe084dca0ec462d57f608652b832f659 [file] [log] [blame]
Brian Silverman4e662aa2022-05-11 23:10:19 -07001// Copyright 2020 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
4// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
5// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
6// option. This file may not be copied, modified, or distributed
7// except according to those terms.
8
9use syn::Attribute;
10
11/// Returns the attribute (if any) which contains a doc comment.
12pub(super) fn get_doc_attrs(attrs: &[Attribute]) -> Vec<Attribute> {
13 attrs
14 .iter()
15 .filter(|a| a.path.get_ident().iter().any(|p| *p == "doc"))
16 .cloned()
17 .collect()
18}