Skip to content

Commit ef5a09e

Browse files
committed
rename IntoOverflowableItem to satisfy clippy
1 parent 547577f commit ef5a09e

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};
2626
use crate::shape::{Indent, Shape};
@@ -420,7 +420,7 @@ pub(crate) fn format_expr(
420420
})
421421
}
422422

423-
pub(crate) fn rewrite_array<'a, T: 'a + IntoOverflowableItem<'a>>(
423+
pub(crate) fn rewrite_array<'a, T: 'a + ToOverflowableItem<'a>>(
424424
name: &'a str,
425425
exprs: impl Iterator<Item = &'a T>,
426426
span: Span,
@@ -1786,7 +1786,7 @@ pub(crate) fn rewrite_field(
17861786
}
17871787
}
17881788

1789-
fn rewrite_tuple_in_visual_indent_style<'a, T: 'a + IntoOverflowableItem<'a>>(
1789+
fn rewrite_tuple_in_visual_indent_style<'a, T: 'a + ToOverflowableItem<'a>>(
17901790
context: &RewriteContext<'_>,
17911791
mut items: impl Iterator<Item = &'a T>,
17921792
span: Span,
@@ -1868,7 +1868,7 @@ fn rewrite_let(
18681868
)
18691869
}
18701870

1871-
pub(crate) fn rewrite_tuple<'a, T: 'a + IntoOverflowableItem<'a>>(
1871+
pub(crate) fn rewrite_tuple<'a, T: 'a + ToOverflowableItem<'a>>(
18721872
context: &'a RewriteContext<'_>,
18731873
items: impl Iterator<Item = &'a T>,
18741874
span: Span,

src/overflow.rs

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

105105
pub(crate) fn map<F, T>(&self, f: F) -> T
106106
where
107-
F: Fn(&dyn IntoOverflowableItem<'a>) -> T,
107+
F: Fn(&dyn ToOverflowableItem<'a>) -> T,
108108
{
109109
match self {
110110
OverflowableItem::Expr(expr) => f(*expr),
@@ -191,60 +191,60 @@ impl<'a> OverflowableItem<'a> {
191191
}
192192
}
193193

194-
pub(crate) trait IntoOverflowableItem<'a>: Rewrite + Spanned {
195-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a>;
194+
pub(crate) trait ToOverflowableItem<'a>: Rewrite + Spanned {
195+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a>;
196196
}
197197

198-
impl<'a, T: 'a + IntoOverflowableItem<'a>> IntoOverflowableItem<'a> for ptr::P<T> {
199-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
200-
(**self).into_overflowable_item()
198+
impl<'a, T: 'a + ToOverflowableItem<'a>> ToOverflowableItem<'a> for ptr::P<T> {
199+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
200+
(**self).to_overflowable_item()
201201
}
202202
}
203203

204-
macro_rules! impl_into_overflowable_item_for_ast_node {
204+
macro_rules! impl_to_overflowable_item_for_ast_node {
205205
($($ast_node:ident),*) => {
206206
$(
207-
impl<'a> IntoOverflowableItem<'a> for ast::$ast_node {
208-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
207+
impl<'a> ToOverflowableItem<'a> for ast::$ast_node {
208+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
209209
OverflowableItem::$ast_node(self)
210210
}
211211
}
212212
)*
213213
}
214214
}
215215

216-
macro_rules! impl_into_overflowable_item_for_rustfmt_types {
216+
macro_rules! impl_to_overflowable_item_for_rustfmt_types {
217217
([$($ty:ident),*], [$($ty_with_lifetime:ident),*]) => {
218218
$(
219-
impl<'a> IntoOverflowableItem<'a> for $ty {
220-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
219+
impl<'a> ToOverflowableItem<'a> for $ty {
220+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
221221
OverflowableItem::$ty(self)
222222
}
223223
}
224224
)*
225225
$(
226-
impl<'a> IntoOverflowableItem<'a> for $ty_with_lifetime<'a> {
227-
fn into_overflowable_item(&'a self) -> OverflowableItem<'a> {
226+
impl<'a> ToOverflowableItem<'a> for $ty_with_lifetime<'a> {
227+
fn to_overflowable_item(&'a self) -> OverflowableItem<'a> {
228228
OverflowableItem::$ty_with_lifetime(self)
229229
}
230230
}
231231
)*
232232
}
233233
}
234234

235-
impl_into_overflowable_item_for_ast_node!(Expr, GenericParam, NestedMetaItem, FieldDef, Ty, Pat);
236-
impl_into_overflowable_item_for_rustfmt_types!([MacroArg], [SegmentParam, TuplePatField]);
235+
impl_to_overflowable_item_for_ast_node!(Expr, GenericParam, NestedMetaItem, FieldDef, Ty, Pat);
236+
impl_to_overflowable_item_for_rustfmt_types!([MacroArg], [SegmentParam, TuplePatField]);
237237

238238
pub(crate) fn into_overflowable_list<'a, T>(
239239
iter: impl Iterator<Item = &'a T>,
240240
) -> impl Iterator<Item = OverflowableItem<'a>>
241241
where
242-
T: 'a + IntoOverflowableItem<'a>,
242+
T: 'a + ToOverflowableItem<'a>,
243243
{
244-
iter.map(|x| IntoOverflowableItem::into_overflowable_item(x))
244+
iter.map(|x| ToOverflowableItem::to_overflowable_item(x))
245245
}
246246

247-
pub(crate) fn rewrite_with_parens<'a, T: 'a + IntoOverflowableItem<'a>>(
247+
pub(crate) fn rewrite_with_parens<'a, T: 'a + ToOverflowableItem<'a>>(
248248
context: &'a RewriteContext<'_>,
249249
ident: &'a str,
250250
items: impl Iterator<Item = &'a T>,
@@ -268,7 +268,7 @@ pub(crate) fn rewrite_with_parens<'a, T: 'a + IntoOverflowableItem<'a>>(
268268
.rewrite(shape)
269269
}
270270

271-
pub(crate) fn rewrite_with_angle_brackets<'a, T: 'a + IntoOverflowableItem<'a>>(
271+
pub(crate) fn rewrite_with_angle_brackets<'a, T: 'a + ToOverflowableItem<'a>>(
272272
context: &'a RewriteContext<'_>,
273273
ident: &'a str,
274274
items: impl Iterator<Item = &'a T>,
@@ -290,7 +290,7 @@ pub(crate) fn rewrite_with_angle_brackets<'a, T: 'a + IntoOverflowableItem<'a>>(
290290
.rewrite(shape)
291291
}
292292

293-
pub(crate) fn rewrite_with_square_brackets<'a, T: 'a + IntoOverflowableItem<'a>>(
293+
pub(crate) fn rewrite_with_square_brackets<'a, T: 'a + ToOverflowableItem<'a>>(
294294
context: &'a RewriteContext<'_>,
295295
name: &'a str,
296296
items: impl Iterator<Item = &'a T>,
@@ -335,7 +335,7 @@ struct Context<'a> {
335335
}
336336

337337
impl<'a> Context<'a> {
338-
fn new<T: 'a + IntoOverflowableItem<'a>>(
338+
fn new<T: 'a + ToOverflowableItem<'a>>(
339339
context: &'a RewriteContext<'_>,
340340
items: impl Iterator<Item = &'a T>,
341341
ident: &'a str,

0 commit comments

Comments
 (0)