Skip to content

Commit 578d753

Browse files
committed
rename IntoOverflowableItem to satisfy clippy
1 parent 40909b4 commit 578d753

2 files changed

Lines changed: 26 additions & 26 deletions

File tree

src/expr.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use crate::lists::{
2020
};
2121
use crate::macros::{rewrite_macro, MacroPosition};
2222
use crate::matches::rewrite_match;
23-
use crate::overflow::{self, IntoOverflowableItem, OverflowableItem};
23+
use crate::overflow::{self, OverflowableItem, ToOverflowableItem};
2424
use crate::pairs::{rewrite_all_pairs, rewrite_pair, PairParts};
2525
use crate::rewrite::{Rewrite, RewriteContext, RewriteError, RewriteErrorExt, RewriteResult};
2626
use crate::shape::{Indent, Shape};
@@ -448,7 +448,7 @@ pub(crate) fn format_expr(
448448
})
449449
}
450450

451-
pub(crate) fn rewrite_array<'a, T: 'a + IntoOverflowableItem<'a>>(
451+
pub(crate) fn rewrite_array<'a, T: 'a + ToOverflowableItem<'a>>(
452452
name: &'a str,
453453
exprs: impl Iterator<Item = &'a T>,
454454
span: Span,
@@ -1867,7 +1867,7 @@ pub(crate) fn rewrite_field(
18671867
}
18681868
}
18691869

1870-
fn rewrite_tuple_in_visual_indent_style<'a, T: 'a + IntoOverflowableItem<'a>>(
1870+
fn rewrite_tuple_in_visual_indent_style<'a, T: 'a + ToOverflowableItem<'a>>(
18711871
context: &RewriteContext<'_>,
18721872
mut items: impl Iterator<Item = &'a T>,
18731873
span: Span,
@@ -1957,7 +1957,7 @@ fn rewrite_let(
19571957
)
19581958
}
19591959

1960-
pub(crate) fn rewrite_tuple<'a, T: 'a + IntoOverflowableItem<'a>>(
1960+
pub(crate) fn rewrite_tuple<'a, T: 'a + ToOverflowableItem<'a>>(
19611961
context: &'a RewriteContext<'_>,
19621962
items: impl Iterator<Item = &'a T>,
19631963
span: Span,

src/overflow.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ impl<'a> OverflowableItem<'a> {
116116

117117
pub(crate) fn map<F, T>(&self, f: F) -> T
118118
where
119-
F: Fn(&dyn IntoOverflowableItem<'a>) -> T,
119+
F: Fn(&dyn ToOverflowableItem<'a>) -> T,
120120
{
121121
match self {
122122
OverflowableItem::Expr(expr) => f(*expr),
@@ -216,48 +216,48 @@ impl<'a> OverflowableItem<'a> {
216216
}
217217
}
218218

219-
pub(crate) trait IntoOverflowableItem<'a>: Rewrite + Spanned {
220-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a>;
219+
pub(crate) trait ToOverflowableItem<'a>: Rewrite + Spanned {
220+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a>;
221221
}
222222

223-
impl<'a, T: 'a + IntoOverflowableItem<'a>> IntoOverflowableItem<'a> for ptr::P<T> {
224-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
225-
(**self).into_overflowable_item()
223+
impl<'a, T: 'a + ToOverflowableItem<'a>> ToOverflowableItem<'a> for ptr::P<T> {
224+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
225+
(**self).to_overflowable_item()
226226
}
227227
}
228228

229-
macro_rules! impl_into_overflowable_item_for_ast_node {
229+
macro_rules! impl_to_overflowable_item_for_ast_node {
230230
($($ast_node:ident),*) => {
231231
$(
232-
impl<'a> IntoOverflowableItem<'a> for ast::$ast_node {
233-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
232+
impl<'a> ToOverflowableItem<'a> for ast::$ast_node {
233+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
234234
OverflowableItem::$ast_node(self)
235235
}
236236
}
237237
)*
238238
}
239239
}
240240

241-
macro_rules! impl_into_overflowable_item_for_rustfmt_types {
241+
macro_rules! impl_to_overflowable_item_for_rustfmt_types {
242242
([$($ty:ident),*], [$($ty_with_lifetime:ident),*]) => {
243243
$(
244-
impl<'a> IntoOverflowableItem<'a> for $ty {
245-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
244+
impl<'a> ToOverflowableItem<'a> for $ty {
245+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
246246
OverflowableItem::$ty(self)
247247
}
248248
}
249249
)*
250250
$(
251-
impl<'a> IntoOverflowableItem<'a> for $ty_with_lifetime<'a> {
252-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
251+
impl<'a> ToOverflowableItem<'a> for $ty_with_lifetime<'a> {
252+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
253253
OverflowableItem::$ty_with_lifetime(self)
254254
}
255255
}
256256
)*
257257
}
258258
}
259259

260-
impl_into_overflowable_item_for_ast_node!(
260+
impl_to_overflowable_item_for_ast_node!(
261261
Expr,
262262
GenericParam,
263263
NestedMetaItem,
@@ -266,18 +266,18 @@ impl_into_overflowable_item_for_ast_node!(
266266
Pat,
267267
PreciseCapturingArg
268268
);
269-
impl_into_overflowable_item_for_rustfmt_types!([MacroArg], [SegmentParam, TuplePatField]);
269+
impl_to_overflowable_item_for_rustfmt_types!([MacroArg], [SegmentParam, TuplePatField]);
270270

271271
pub(crate) fn into_overflowable_list<'a, T>(
272272
iter: impl Iterator<Item = &'a T>,
273273
) -> impl Iterator<Item = OverflowableItem<'a>>
274274
where
275-
T: 'a + IntoOverflowableItem<'a>,
275+
T: 'a + ToOverflowableItem<'a>,
276276
{
277-
iter.map(|x| IntoOverflowableItem::into_overflowable_item(x))
277+
iter.map(|x| ToOverflowableItem::to_overflowable_item(x))
278278
}
279279

280-
pub(crate) fn rewrite_with_parens<'a, T: 'a + IntoOverflowableItem<'a>>(
280+
pub(crate) fn rewrite_with_parens<'a, T: 'a + ToOverflowableItem<'a>>(
281281
context: &'a RewriteContext<'_>,
282282
ident: &'a str,
283283
items: impl Iterator<Item = &'a T>,
@@ -301,7 +301,7 @@ pub(crate) fn rewrite_with_parens<'a, T: 'a + IntoOverflowableItem<'a>>(
301301
.rewrite(shape)
302302
}
303303

304-
pub(crate) fn rewrite_with_angle_brackets<'a, T: 'a + IntoOverflowableItem<'a>>(
304+
pub(crate) fn rewrite_with_angle_brackets<'a, T: 'a + ToOverflowableItem<'a>>(
305305
context: &'a RewriteContext<'_>,
306306
ident: &'a str,
307307
items: impl Iterator<Item = &'a T>,
@@ -323,7 +323,7 @@ pub(crate) fn rewrite_with_angle_brackets<'a, T: 'a + IntoOverflowableItem<'a>>(
323323
.rewrite(shape)
324324
}
325325

326-
pub(crate) fn rewrite_with_square_brackets<'a, T: 'a + IntoOverflowableItem<'a>>(
326+
pub(crate) fn rewrite_with_square_brackets<'a, T: 'a + ToOverflowableItem<'a>>(
327327
context: &'a RewriteContext<'_>,
328328
name: &'a str,
329329
items: impl Iterator<Item = &'a T>,
@@ -368,7 +368,7 @@ struct Context<'a> {
368368
}
369369

370370
impl<'a> Context<'a> {
371-
fn new<T: 'a + IntoOverflowableItem<'a>>(
371+
fn new<T: 'a + ToOverflowableItem<'a>>(
372372
context: &'a RewriteContext<'_>,
373373
items: impl Iterator<Item = &'a T>,
374374
ident: &'a str,

0 commit comments

Comments
 (0)