Skip to content

Commit 41ff220

Browse files
committed
rename IntoOverflowableItem to satisfy clippy
1 parent 5f48fe9 commit 41ff220

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};
@@ -436,7 +436,7 @@ pub(crate) fn format_expr(
436436
})
437437
}
438438

439-
pub(crate) fn rewrite_array<'a, T: 'a + IntoOverflowableItem<'a>>(
439+
pub(crate) fn rewrite_array<'a, T: 'a + ToOverflowableItem<'a>>(
440440
name: &'a str,
441441
exprs: impl Iterator<Item = &'a T>,
442442
span: Span,
@@ -1854,7 +1854,7 @@ pub(crate) fn rewrite_field(
18541854
}
18551855
}
18561856

1857-
fn rewrite_tuple_in_visual_indent_style<'a, T: 'a + IntoOverflowableItem<'a>>(
1857+
fn rewrite_tuple_in_visual_indent_style<'a, T: 'a + ToOverflowableItem<'a>>(
18581858
context: &RewriteContext<'_>,
18591859
mut items: impl Iterator<Item = &'a T>,
18601860
span: Span,
@@ -1944,7 +1944,7 @@ fn rewrite_let(
19441944
)
19451945
}
19461946

1947-
pub(crate) fn rewrite_tuple<'a, T: 'a + IntoOverflowableItem<'a>>(
1947+
pub(crate) fn rewrite_tuple<'a, T: 'a + ToOverflowableItem<'a>>(
19481948
context: &'a RewriteContext<'_>,
19491949
items: impl Iterator<Item = &'a T>,
19501950
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),
@@ -217,48 +217,48 @@ impl<'a> OverflowableItem<'a> {
217217
}
218218
}
219219

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

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

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

242-
macro_rules! impl_into_overflowable_item_for_rustfmt_types {
242+
macro_rules! impl_to_overflowable_item_for_rustfmt_types {
243243
([$($ty:ident),*], [$($ty_with_lifetime:ident),*]) => {
244244
$(
245-
impl<'a> IntoOverflowableItem<'a> for $ty {
246-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
245+
impl<'a> ToOverflowableItem<'a> for $ty {
246+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
247247
OverflowableItem::$ty(self)
248248
}
249249
}
250250
)*
251251
$(
252-
impl<'a> IntoOverflowableItem<'a> for $ty_with_lifetime<'a> {
253-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
252+
impl<'a> ToOverflowableItem<'a> for $ty_with_lifetime<'a> {
253+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
254254
OverflowableItem::$ty_with_lifetime(self)
255255
}
256256
}
257257
)*
258258
}
259259
}
260260

261-
impl_into_overflowable_item_for_ast_node!(
261+
impl_to_overflowable_item_for_ast_node!(
262262
Expr,
263263
GenericParam,
264264
NestedMetaItem,
@@ -267,18 +267,18 @@ impl_into_overflowable_item_for_ast_node!(
267267
Pat,
268268
PreciseCapturingArg
269269
);
270-
impl_into_overflowable_item_for_rustfmt_types!([MacroArg], [SegmentParam, TuplePatField]);
270+
impl_to_overflowable_item_for_rustfmt_types!([MacroArg], [SegmentParam, TuplePatField]);
271271

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

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

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

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

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

0 commit comments

Comments
 (0)