Skip to content

Commit 989fbac

Browse files
committed
rename IntoOverflowableItem to satisfy clippy
1 parent b47f06f commit 989fbac

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
@@ -21,7 +21,7 @@ use crate::lists::{
2121
};
2222
use crate::macros::{MacroPosition, rewrite_macro};
2323
use crate::matches::rewrite_match;
24-
use crate::overflow::{self, IntoOverflowableItem, OverflowableItem};
24+
use crate::overflow::{self, OverflowableItem, ToOverflowableItem};
2525
use crate::pairs::{PairParts, rewrite_all_pairs, rewrite_pair};
2626
use crate::rewrite::{Rewrite, RewriteContext, RewriteError, RewriteErrorExt, RewriteResult};
2727
use crate::shape::{Indent, Shape};
@@ -499,7 +499,7 @@ pub(crate) fn format_expr(
499499
})
500500
}
501501

502-
pub(crate) fn rewrite_array<'a, T: 'a + IntoOverflowableItem<'a>>(
502+
pub(crate) fn rewrite_array<'a, T: 'a + ToOverflowableItem<'a>>(
503503
name: &'a str,
504504
exprs: impl Iterator<Item = &'a T>,
505505
span: Span,
@@ -1973,7 +1973,7 @@ pub(crate) fn rewrite_field(
19731973
}
19741974
}
19751975

1976-
fn rewrite_tuple_in_visual_indent_style<'a, T: 'a + IntoOverflowableItem<'a>>(
1976+
fn rewrite_tuple_in_visual_indent_style<'a, T: 'a + ToOverflowableItem<'a>>(
19771977
context: &RewriteContext<'_>,
19781978
mut items: impl Iterator<Item = &'a T>,
19791979
span: Span,
@@ -2059,7 +2059,7 @@ fn rewrite_let(
20592059
)
20602060
}
20612061

2062-
pub(crate) fn rewrite_tuple<'a, T: 'a + IntoOverflowableItem<'a>>(
2062+
pub(crate) fn rewrite_tuple<'a, T: 'a + ToOverflowableItem<'a>>(
20632063
context: &'a RewriteContext<'_>,
20642064
items: impl Iterator<Item = &'a T>,
20652065
span: Span,

src/overflow.rs

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

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

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

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

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

240-
macro_rules! impl_into_overflowable_item_for_rustfmt_types {
240+
macro_rules! impl_to_overflowable_item_for_rustfmt_types {
241241
([$($ty:ident),*], [$($ty_with_lifetime:ident),*]) => {
242242
$(
243-
impl<'a> IntoOverflowableItem<'a> for $ty {
244-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
243+
impl<'a> ToOverflowableItem<'a> for $ty {
244+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
245245
OverflowableItem::$ty(self)
246246
}
247247
}
248248
)*
249249
$(
250-
impl<'a> IntoOverflowableItem<'a> for $ty_with_lifetime<'a> {
251-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
250+
impl<'a> ToOverflowableItem<'a> for $ty_with_lifetime<'a> {
251+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
252252
OverflowableItem::$ty_with_lifetime(self)
253253
}
254254
}
255255
)*
256256
}
257257
}
258258

259-
impl_into_overflowable_item_for_ast_node!(
259+
impl_to_overflowable_item_for_ast_node!(
260260
Expr,
261261
GenericParam,
262262
MetaItemInner,
@@ -265,18 +265,18 @@ impl_into_overflowable_item_for_ast_node!(
265265
Pat,
266266
PreciseCapturingArg
267267
);
268-
impl_into_overflowable_item_for_rustfmt_types!([MacroArg], [SegmentParam, TuplePatField]);
268+
impl_to_overflowable_item_for_rustfmt_types!([MacroArg], [SegmentParam, TuplePatField]);
269269

270270
pub(crate) fn into_overflowable_list<'a, T>(
271271
iter: impl Iterator<Item = &'a T>,
272272
) -> impl Iterator<Item = OverflowableItem<'a>>
273273
where
274-
T: 'a + IntoOverflowableItem<'a>,
274+
T: 'a + ToOverflowableItem<'a>,
275275
{
276-
iter.map(|x| IntoOverflowableItem::into_overflowable_item(x))
276+
iter.map(|x| ToOverflowableItem::to_overflowable_item(x))
277277
}
278278

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

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

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

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

0 commit comments

Comments
 (0)