Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
with:
submodules: recursive
- uses: bufbuild/buf-setup-action@v1.50.0
with:
github_token: ${{ github.token }}
- run: buf format --diff --exit-code

check:
Expand All @@ -27,6 +29,8 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: bufbuild/buf-setup-action@v1.50.0
with:
github_token: ${{ github.token }}
- uses: bufbuild/buf-lint-action@v1.1.1
- name: Compile protobuf
run: buf generate
6 changes: 3 additions & 3 deletions py/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ fn main() {
{
// Use vendored protobuf compiler if requested.
protoc_path = protobuf_src::protoc();
println!("cargo:warning=Using vendored protoc: {:?}", protoc_path);
println!("cargo:warning=Using vendored protoc: {protoc_path:?}");
}
#[cfg(not(feature = "protoc"))]
{
Expand All @@ -106,7 +106,7 @@ fn main() {
if !output.status.success() {
eprintln!("cmd: {:?}", cmd.get_program());
for arg in cmd.get_args() {
eprintln!("arg: {:?}", arg);
eprintln!("arg: {arg:?}");
}
panic!("{:?}", output);
}
Expand Down Expand Up @@ -156,7 +156,7 @@ fn main() {
} else {
line
};
writeln!(output, "{}", line).unwrap();
writeln!(output, "{line}").unwrap();
}
}

Expand Down
8 changes: 4 additions & 4 deletions rs/src/export/html/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ fn format_span<S: std::fmt::Display>(class: &'static str, text: S) -> String {

/// Creates a span with the given class name.
fn format_span_html<S: std::fmt::Display>(class: &'static str, html: S) -> String {
format!("<span class=\"{class}\">{}</span>", html)
format!("<span class=\"{class}\">{html}</span>")
}

/// Formats a diagnostic message box. path should be the node that the
Expand All @@ -242,7 +242,7 @@ fn format_diagnostic(
if with_path {
diag.to_string()
} else {
format!("{:#}", diag)
format!("{diag:#}")
},
);
let cause = if &diag.path == path {
Expand Down Expand Up @@ -452,7 +452,7 @@ fn format_data_type(prefix: &str, data_type: &data::Type) -> Vec<String> {
let mut html = vec![];

if data_type.parameters().is_empty() {
html.push(format_data_type_card(&format!("{prefix}: {:#}", data_type)));
html.push(format_data_type_card(&format!("{prefix}: {data_type:#}")));
} else {
html.push("<details class=\"data_type\">\n<summary>".to_string());
html.push(format!("{prefix}: {}", html_escape(data_type.to_string())));
Expand Down Expand Up @@ -624,7 +624,7 @@ pub fn export<T: std::io::Write>(

// Generate and write header.
let font_awesome_b64 = general_purpose::STANDARD.encode(FONT_AWESOME);
write!(out, "{HEADER1}{}{HEADER2}", font_awesome_b64)?;
write!(out, "{HEADER1}{font_awesome_b64}{HEADER2}")?;

// Emit metadata.
writeln!(out, "<details class=\"relation_tree\" open=\"true\">")?;
Expand Down
17 changes: 5 additions & 12 deletions rs/src/output/diagnostic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ impl Classification {

/// Returns the name of the classiciation.
pub fn name(&self) -> String {
format!("{:?}", self)
format!("{self:?}")
}

/// Returns the group code for this classification.
Expand All @@ -388,8 +388,7 @@ impl Classification {

/// Returns the group variant for this classification.
pub fn group(&self) -> Classification {
Self::from_group(self.group_code())
.unwrap_or_else(|| panic!("missing group for {:?}", self))
Self::from_group(self.group_code()).unwrap_or_else(|| panic!("missing group for {self:?}"))
}

/// Returns the code for this classification within its group.
Expand All @@ -402,10 +401,7 @@ impl Classification {
self.get_str("Description")
.or_else(|| self.get_str("HiddenDescription"))
.unwrap_or_else(|| {
panic!(
"missing Description or HiddenDescription property for {:?}",
self
)
panic!("missing Description or HiddenDescription property for {self:?}")
})
}

Expand Down Expand Up @@ -644,15 +640,12 @@ mod tests {
if group != Classification::Unclassified {
assert!(
class.name().starts_with(&group.name()),
"incorrect group prefix for {:?}, should start with {:?}",
class,
group
"incorrect group prefix for {class:?}, should start with {group:?}"
);
}
assert!(
descriptions.insert(class.description().to_string()),
"duplicate description for {:?}",
class
"duplicate description for {class:?}"
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions rs/src/output/extension/simple/type_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,15 +142,15 @@ impl ParameterInfo for Definition {
if self.parameters_variadic && index + 1 >= self.parameter_slots.len() {
if let Some(slot) = self.parameter_slots.last() {
return Some(if slot.name.is_empty() {
format!("{}", index)
format!("{index}")
} else {
format!("{}.{}", slot.name, index + 1 - self.parameter_slots.len())
});
}
}
self.parameter_slots.get(index).map(|slot| {
if slot.name.is_empty() {
format!("{}", index)
format!("{index}")
} else {
slot.name.clone()
}
Expand Down
2 changes: 1 addition & 1 deletion rs/src/output/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl PathElement {
/// Same as to_string(), but doesn't include the dot prefix for the
/// variants that would normally have one.
pub fn to_string_without_dot(&self) -> String {
format!("{:#}", self)
format!("{self:#}")
}
}

Expand Down
2 changes: 1 addition & 1 deletion rs/src/output/primitive_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn hexdump(f: &mut std::fmt::Formatter<'_>, x: &[u8]) -> std::fmt::Result {
if i > 0 {
write!(f, " ")?;
}
write!(f, "{:02X}", b)?;
write!(f, "{b:02X}")?;
}
Ok(())
}
Expand Down
6 changes: 3 additions & 3 deletions rs/src/output/type_system/data/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub trait ParameterInfo {
/// if the name is not known.
fn parameter_name_or_index(&self, index: usize) -> String {
self.parameter_name(index)
.unwrap_or_else(|| format!("{}", index))
.unwrap_or_else(|| format!("{index}"))
}

/// Whether this type supports parameters. This is used to determine
Expand Down Expand Up @@ -338,8 +338,8 @@ impl ParameterInfo for Compound {
(Compound::FixedBinary, 0) => Some(String::from("length")),
(Compound::Decimal, 0) => Some(String::from("precision")),
(Compound::Decimal, 1) => Some(String::from("scale")),
(Compound::Struct, i) => Some(format!("{}", i)),
(Compound::NamedStruct, i) => Some(format!("{}", i)),
(Compound::Struct, i) => Some(format!("{i}")),
(Compound::NamedStruct, i) => Some(format!("{i}")),
(Compound::List, 0) => Some(String::from("element")),
(Compound::Map, 0) => Some(String::from("key")),
(Compound::Map, 1) => Some(String::from("value")),
Expand Down
2 changes: 1 addition & 1 deletion rs/src/output/type_system/data/type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl Describe for Definition {
if let data::Variation::UserDefined(variation) = &self.variation {
write!(&mut name, "[{variation}]")?;
}
write!(f, "{}", name)?;
write!(f, "{name}")?;
let (_, limit) = limit.split(name.len());
if self.class.has_parameters() {
write!(f, "<")?;
Expand Down
6 changes: 3 additions & 3 deletions rs/src/output/type_system/meta/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,7 @@ impl Pattern for Value {
/// `MIRROR` nullability behavior.
///
/// Syntax: a `?` followed by any identifier.
///
///
/// ## Consistent bindings with nullability suffix
///
/// (inconsistent = false, nullability = Some(pattern))
Expand Down Expand Up @@ -630,7 +630,7 @@ impl Describe for DataType {
) -> std::fmt::Result {
let mut non_recursive = String::new();
if let Some(class) = &self.class {
write!(&mut non_recursive, "{}", class)?;
write!(&mut non_recursive, "{class}")?;
} else {
write!(&mut non_recursive, "typename")?;
}
Expand All @@ -641,7 +641,7 @@ impl Describe for DataType {
x => write!(&mut non_recursive, "?{x}")?,
}
write!(&mut non_recursive, "{}", self.variation)?;
write!(f, "{}", non_recursive)?;
write!(f, "{non_recursive}")?;
if let Some(parameters) = &self.parameters {
write!(f, "<")?;
util::string::describe_sequence(f, parameters, limit, 20, |f, param, _, limit| {
Expand Down
2 changes: 1 addition & 1 deletion rs/src/parse/expressions/references/scalar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ fn parse_map_key(
);

// Create description.
let description = format!(".[{}]", key);
let description = format!(".[{key}]");

// Determine result data type.
let data_type = root.unwrap_map().unwrap_or_default();
Expand Down
18 changes: 7 additions & 11 deletions rs/src/parse/relations/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,35 +139,31 @@ pub fn parse_join_rel(x: &substrait::JoinRel, y: &mut context::Context) -> diagn
JoinType::Inner => format!(
"Returns rows combining the row from the left and right \
input for each pair where the join expression yields true, \
discarding rows where the join expression yields {}.",
nullable
discarding rows where the join expression yields {nullable}."
),
JoinType::Outer => format!(
"Returns rows combining the row from the left and right \
input for each pair where the join expression yields true, \
discarding rows where the join expression yields {}. \
discarding rows where the join expression yields {nullable}. \
If the join expression never yields true for any left or \
right row, this returns a row anyway, with the fields \
corresponding to the other input set to null.",
nullable
corresponding to the other input set to null."
),
JoinType::Left => format!(
"Returns rows combining the row from the left and right \
input for each pair where the join expression yields true, \
discarding rows where the join expression yields {}. \
discarding rows where the join expression yields {nullable}. \
If the join expression never yields true for a row from the \
left, this returns a row anyway, with the fields corresponding \
to the right input set to null.",
nullable
to the right input set to null."
),
JoinType::Right => format!(
"Returns rows combining the row from the left and right \
input for each pair where the join expression yields true, \
discarding rows where the join expression yields {}. \
discarding rows where the join expression yields {nullable}. \
If the join expression never yields true for a row from the \
right, this returns a row anyway, with the fields corresponding \
to the left input set to null.",
nullable
to the left input set to null."
),
JoinType::LeftSemi => "Filters rows from the left input, propagating a row only if \
the join expression yields true for that row combined with \
Expand Down
8 changes: 4 additions & 4 deletions rs/src/util/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ fn write_truncated_str(
if quote {
write!(f, "{}", as_quoted_string(&left_part))?;
} else {
write!(f, "{}", left_part)?;
write!(f, "{left_part}")?;
}
}
if let Some(n_right) = n_right {
Expand All @@ -309,7 +309,7 @@ fn write_truncated_str(
if quote {
write!(f, "{}", as_quoted_string(&right_part))?;
} else {
write!(f, "{}", right_part)?;
write!(f, "{right_part}")?;
}
}
}
Expand Down Expand Up @@ -456,7 +456,7 @@ mod tests {

for (input, expected) in test_cases {
let output = test_describe_with_limit(input, Limit::new(3), describe_identifier);
assert_eq!(output, expected, "Failed for input: {}", input);
assert_eq!(output, expected, "Failed for input: {input}");
}
}

Expand All @@ -470,7 +470,7 @@ mod tests {

for (input, expected) in test_cases {
let output = test_describe_with_limit(input, Limit::new(3), describe_string);
assert_eq!(output, expected, "Failed for input: {}", input);
assert_eq!(output, expected, "Failed for input: {input}");
}
}
}
2 changes: 1 addition & 1 deletion tests/src/find_protoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn main() {
{
// Use vendored protobuf compiler if requested.
protoc_path = protobuf_src::protoc();
println!("cargo:warning=Using vendored protoc: {:?}", protoc_path);
println!("cargo:warning=Using vendored protoc: {protoc_path:?}");
}
#[cfg(not(feature = "protoc"))]
{
Expand Down
Loading