Skip to content

Commit

Permalink
Rename display_chain -> iter_display_chain
Browse files Browse the repository at this point in the history
Summary: Previous diff D44739200 explains why.

Reviewed By: JakobDegen

Differential Revision: D44739201

fbshipit-source-id: 2b47930c6b4e44ac7b4c94fcd786889c3886cf52
  • Loading branch information
stepancheg authored and facebook-github-bot committed Apr 7, 2023
1 parent f1a54d8 commit e79c226
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions app/buck2_build_api/src/interpreter/rule_defs/cmd_args/typ.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ use std::ops::Deref;
use allocative::Allocative;
use buck2_core::fs::paths::RelativePathBuf;
use derive_more::Display;
use display_container::display_chain;
use display_container::display_pair;
use display_container::fmt_container;
use display_container::iter_display_chain;
use dupe::Dupe;
use either::Either;
use gazebo::prelude::*;
Expand Down Expand Up @@ -158,9 +158,9 @@ impl<'v, V: ValueLike<'v>> Display for StarlarkCommandLineDataGen<'v, V> {
f,
"cmd_args(",
")",
display_chain(
iter_display_chain(
&self.items,
display_chain(
iter_display_chain(
Some(&self.hidden).filter(|x| !x.is_empty()).map(|hidden| {
struct Wrapper<'a, V>(&'a Vec<CommandLineArgGen<V>>);
impl<'a, V: Display> Display for Wrapper<'a, V> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ use std::iter;

use allocative::Allocative;
use anyhow::Context as _;
use display_container::display_chain;
use display_container::display_pair;
use display_container::fmt_container;
use display_container::iter_display_chain;
use dupe::Dupe;
use gazebo::prelude::*;
use serde::ser::SerializeMap;
Expand Down Expand Up @@ -94,7 +94,7 @@ impl<V: fmt::Display> fmt::Display for TransitiveSetGen<V> {
f,
&format!("{}(", self.definition),
")",
display_chain(
iter_display_chain(
self.node
.as_ref()
.map(|node| display_pair("value", "=", &node.value)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use std::iter;

use allocative::Allocative;
use anyhow::Context as _;
use display_container::display_chain;
use display_container::display_pair;
use display_container::fmt_container;
use display_container::iter_display_chain;
use dupe::Dupe;
use starlark::any::ProvidesStaticType;
use starlark::coerce::Coerce;
Expand Down Expand Up @@ -72,7 +72,7 @@ impl<'v, V: ValueLike<'v>> Display for TransitiveSetArgsProjectionGen<V> {
f,
"TransitiveSetProjection(",
")",
display_chain(
iter_display_chain(
iter::once(projection_name),
iter::once(display_pair("transitive_set", "=", &self.transitive_set)),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use std::iter;

use allocative::Allocative;
use anyhow::Context as _;
use display_container::display_chain;
use display_container::display_pair;
use display_container::fmt_container;
use display_container::iter_display_chain;
use dupe::Dupe;
use starlark::any::ProvidesStaticType;
use starlark::coerce::Coerce;
Expand Down Expand Up @@ -63,7 +63,7 @@ impl<'v, V: ValueLike<'v>> Display for TransitiveSetJsonProjectionGen<V> {
f,
"TransitiveSetProjection(",
")",
display_chain(
iter_display_chain(
iter::once(projection_name),
iter::once(display_pair("transitive_set", "=", &self.transitive_set)),
),
Expand Down
6 changes: 3 additions & 3 deletions gazebo/display_container/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
//! impl fmt::Display for MyItems {
//! fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
//! fmt_container(f, "{", "}",
//! display_chain(
//! iter_display_chain(
//! &["magic"],
//! self.0.iter().map(|(k, v)| display_pair(k, "=", v))
//! )
Expand Down Expand Up @@ -216,7 +216,7 @@ pub fn fmt_keyed_container<K: Display, V: Display, Iter: IntoIterator<Item = (K,
}

/// Chain two iterators together that produce `Display` items.
pub fn display_chain<A, B>(first: A, second: B) -> impl Iterator<Item = impl Display>
pub fn iter_display_chain<A, B>(first: A, second: B) -> impl Iterator<Item = impl Display>
where
A: IntoIterator,
A::Item: Display,
Expand Down Expand Up @@ -312,7 +312,7 @@ mod tests {
f,
"{",
"}",
display_chain(
iter_display_chain(
&["magic"],
self.0.iter().map(|(k, v)| display_pair(k, "=", v)),
),
Expand Down

0 comments on commit e79c226

Please sign in to comment.