mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Add a ruff_textwrap
crate (#4731)
This commit is contained in:
parent
35cd57d0fc
commit
399eb84d5e
14 changed files with 397 additions and 68 deletions
|
@ -10,8 +10,9 @@ proc-macro = true
|
|||
doctest = false
|
||||
|
||||
[dependencies]
|
||||
ruff_textwrap = { path = "../ruff_textwrap" }
|
||||
|
||||
proc-macro2 = { workspace = true }
|
||||
quote = { workspace = true }
|
||||
syn = { workspace = true, features = ["derive", "parsing", "extra-traits", "full"] }
|
||||
textwrap = { workspace = true }
|
||||
itertools = { workspace = true }
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
use ruff_textwrap::dedent;
|
||||
|
||||
use quote::{quote, quote_spanned};
|
||||
use syn::parse::{Parse, ParseStream};
|
||||
use syn::spanned::Spanned;
|
||||
|
@ -126,7 +128,7 @@ fn handle_option(
|
|||
docs: Vec<&Attribute>,
|
||||
) -> syn::Result<proc_macro2::TokenStream> {
|
||||
// Convert the list of `doc` attributes into a single string.
|
||||
let doc = textwrap::dedent(
|
||||
let doc = dedent(
|
||||
&docs
|
||||
.into_iter()
|
||||
.map(parse_doc)
|
||||
|
@ -179,7 +181,7 @@ impl Parse for FieldAttributes {
|
|||
Ok(Self {
|
||||
default,
|
||||
value_type,
|
||||
example: textwrap::dedent(&example).trim_matches('\n').to_string(),
|
||||
example: dedent(&example).trim_matches('\n').to_string(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue