Skip to content

Commit 00c4309

Browse files
zertoshfacebook-github-bot
authored andcommitted
Update to rustfmt 1.6.0-nightly (839e9a6 2023-07-02)
Summary: Update to rustfmt 1.6.0-nightly (839e9a6 2023-07-02) The big ticket item here is that let-else is now supported! In fact, the suppport just landed two days ago (see [rust-lang/rustfmt#4914]) The unfortunate thing here though is that rustfmt is not statically linked anymore (see discussion in [rust-lang/rust#107297]). So we need all of librustc_driver and libstd - which makes our use case pretty big (~4-5MB to 50MB-100MB). We should explore building from source and statically linking, or using rustfmt from the toolchain. Both things that I don't want to deal with right now. [rust-lang/rustfmt#4914]: rust-lang/rustfmt#4914 [rust-lang/rust#107297]: rust-lang/rust#107297 Note to future updaters: To find out more-or-less what libs you need, you can use `objdump -p bin/rustfmt | grep NEEDED` on Linux for ELF bins, and `otool -L bin/rustfmt` on macOS for Mach-O bins. No idea what you do for Windows. Ran `tools/arcanist/lint/codemods/rustfmt-fbsource` to format the repo. Reviewed By: shayne-fletcher Differential Revision: D47203254 fbshipit-source-id: 6ffd3ce66c7f2b006d09505b93fed515ebc76902
1 parent bd8f86a commit 00c4309

File tree

7 files changed

+25
-28
lines changed

7 files changed

+25
-28
lines changed

app/buck2_client_ctx/src/events_ctx.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ impl From<tonic::Status> for BuckdCommunicationError {
7171
#[async_trait]
7272
pub trait PartialResultHandler {
7373
type PartialResult: TryFrom<
74-
buck2_cli_proto::partial_result::PartialResult,
75-
Error = buck2_cli_proto::partial_result::PartialResult,
76-
>;
74+
buck2_cli_proto::partial_result::PartialResult,
75+
Error = buck2_cli_proto::partial_result::PartialResult,
76+
>;
7777

7878
async fn handle_partial_result(
7979
&mut self,

app/buck2_core/src/cells/nested.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,19 @@ impl NestedCells {
5252
all_cells: &[(CellName, &CellRootPath)],
5353
this_cell: &CellRootPath,
5454
) -> NestedCells {
55-
Self::from_cell_paths_relative_to_this_cell(all_cells.iter()
56-
.filter_map(|(cell_name, cell_root_path)| {
57-
let Some(path_relative_to_this_cell) = cell_root_path.strip_prefix_opt(this_cell) else {
55+
Self::from_cell_paths_relative_to_this_cell(all_cells.iter().filter_map(
56+
|(cell_name, cell_root_path)| {
57+
let Some(path_relative_to_this_cell) = cell_root_path.strip_prefix_opt(this_cell)
58+
else {
5859
return None;
5960
};
6061

6162
Some((
6263
CellRelativePath::new(path_relative_to_this_cell),
6364
*cell_name,
6465
))
65-
}))
66+
},
67+
))
6668
}
6769

6870
pub fn matches<'a, 'b>(

app/buck2_interpreter_for_build/src/attrs/coerce/attr_type/visibility.rs

+2-7
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,9 @@ pub(crate) fn parse_visibility_with_view(
7070
for item in list {
7171
let Some(item) = item.unpack_str() else {
7272
if StarlarkSelector::from_value(*item).is_some() {
73-
return Err(VisibilityAttrTypeCoerceError::NotConfigurable(
74-
attr.to_repr(),
75-
)
76-
.into());
73+
return Err(VisibilityAttrTypeCoerceError::NotConfigurable(attr.to_repr()).into());
7774
}
78-
return Err(VisibilityAttrTypeCoerceError::WrongType(
79-
attr.to_repr(),
80-
).into());
75+
return Err(VisibilityAttrTypeCoerceError::WrongType(attr.to_repr()).into());
8176
};
8277

8378
if item == VisibilityPattern::PUBLIC {

starlark-rust/starlark/src/eval/compiler/types.rs

+8-4
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,14 @@ impl<'v> Compiler<'v, '_, '_> {
7373
let Some(type_value) = expr.payload else {
7474
// This is unreachable. But unfortunately we do not return error here.
7575
// Still make an error in panic to produce nice panic message.
76-
panic!("{:?}", EvalException::new(
77-
TypesError::TypePayloadNotSet.into(),
78-
expr.span,
79-
&self.codemap));
76+
panic!(
77+
"{:?}",
78+
EvalException::new(
79+
TypesError::TypePayloadNotSet.into(),
80+
expr.span,
81+
&self.codemap
82+
)
83+
);
8084
};
8185
if type_value.type_is_wildcard() {
8286
return None;

starlark-rust/starlark/src/values/types/int_or_big.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ impl<'v> StarlarkIntRef<'v> {
362362
Ok(StarlarkInt::Small(InlineInt::MINUS_ONE))
363363
} else {
364364
Ok(StarlarkInt::Small(InlineInt::ZERO))
365-
}
365+
};
366366
};
367367

368368
match self {

starlark-rust/starlark/src/values/types/string/interpolation.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,9 @@ impl<'a> Iterator for PercentFormatParser<'a> {
152152
_ => {
153153
// Note we need to find the second character, not the second byte.
154154
let Some(c) = rem.chars().nth(1) else {
155-
return Some(Err(StringInterpolationError::ExpectingFormatCharacter.into()));
155+
return Some(Err(
156+
StringInterpolationError::ExpectingFormatCharacter.into(),
157+
));
156158
};
157159
return Some(Err(
158160
StringInterpolationError::UnsupportedFormatCharacter(c).into(),

starlark-rust/starlark_derive/src/starlark_value.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,10 @@ fn is_impl_starlark_value(
8989
) -> syn::Result<ImplStarlarkValue> {
9090
let err = "expected `impl StarlarkValue for ...`";
9191
let Some((_, path, _)) = &input.trait_ else {
92-
return Err(syn::Error::new_spanned(
93-
input,
94-
err,
95-
));
92+
return Err(syn::Error::new_spanned(input, err));
9693
};
9794
let Some(last) = path.segments.last() else {
98-
return Err(syn::Error::new_spanned(
99-
path,
100-
err,
101-
));
95+
return Err(syn::Error::new_spanned(path, err));
10296
};
10397
if last.ident != "StarlarkValue" {
10498
return Err(syn::Error::new_spanned(&last.ident, err));

0 commit comments

Comments
 (0)