Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
update to Rust 1.65.0
Browse files Browse the repository at this point in the history
Summary:
Added `fbcode` symlinks for `platform010` & `platform010-aarch64` and addressed the following fixes:
* Account for stabilized [`#![feature(backtrace)]`](rust-lang/rust#99573) and [`#![feature(generic_associated_types)]`](rust-lang/rust#99573)
* Account for removal of [`#![feature(result_into_ok_or_err)]`](rust-lang/rust#100604)
* Account for migration of [`std::io::ReadBuf` to `std::io::BorrowBuf|BorrowCursor`](rust-lang/rust#97015)
* Account for [`Error` trait move into core](rust-lang/rust#99917)
* Account for `#[warn(non_camel_case_types)]`
* Various function signature, lifetime requirement changes and lint fixes

Reviewed By: zertosh

Differential Revision: D40923615

fbshipit-source-id: f7ac2828d74edeae39aae517172207b0ee998a59
  • Loading branch information
diliop authored and facebook-github-bot committed Nov 10, 2022
1 parent efb7d9e commit 2a7b83e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions gazebo_lint/src/clippy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ pub fn method_calls<'tcx>(

let mut current = expr;
for _ in 0..max_depth {
if let ExprKind::MethodCall(path, args, _) = &current.kind {
if let ExprKind::MethodCall(path, receiver, args, _) = &current.kind {
method_names.push(path.ident.name);
arg_lists.push(&**args);
spans.push(path.ident.span);
current = &args[0];
current = receiver;
if current.span.from_expansion() {
break;
}
Expand Down
22 changes: 11 additions & 11 deletions gazebo_lint/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,10 @@ fn check_use_slice_cloned_kind(
/// Look for `x.clone()`
/// Where the type of `x` implements `Dupe`.
fn check_use_dupe(cx: &LateContext, expr: &Expr) {
if let ExprKind::MethodCall(method_call, args, _) = expr.kind {
if args.len() == 1 && method_call.ident.name == sym!(clone) {
if let ExprKind::MethodCall(method_call, receiver, args, _) = expr.kind {
if args.is_empty() && method_call.ident.name == sym!(clone) {
if let Some(dupe_trait) = clippy::get_trait_def_id(cx, &["gazebo", "dupe", "Dupe"]) {
let mut cloned_type = cx.typeck_results().expr_ty(&args[0]).peel_refs();
let mut cloned_type = cx.typeck_results().expr_ty(receiver).peel_refs();
loop {
if clippy::implements_trait(cx, cloned_type, dupe_trait, &[]) {
emit_suggestion(
Expand Down Expand Up @@ -350,12 +350,12 @@ fn check_use_dupe(cx: &LateContext, expr: &Expr) {
/// Look for `x.cloned()`
/// Where the type of the `::Item` of `x` implements `Dupe`.
fn check_use_duped(cx: &LateContext, expr: &Expr) {
if let ExprKind::MethodCall(method_call, args, _) = expr.kind {
if args.len() == 1 && method_call.ident.name == sym!(cloned) {
if let ExprKind::MethodCall(method_call, receiver, args, _) = expr.kind {
if args.is_empty() && method_call.ident.name == sym!(cloned) {
if let Some(iterator_trait) =
clippy::get_trait_def_id(cx, &["gazebo", "ext", "iter", "IterDuped"])
{
let mut cloned_type = cx.typeck_results().expr_ty(&args[0]);
let mut cloned_type = cx.typeck_results().expr_ty(receiver);
loop {
if clippy::implements_trait(cx, cloned_type, iterator_trait, &[]) {
emit_suggestion(
Expand Down Expand Up @@ -384,12 +384,12 @@ fn check_use_duped(cx: &LateContext, expr: &Expr) {
/// Look for `x.dupe()`
/// Where the type of `x` implements `Copy`.
fn check_dupe_on_copy(cx: &LateContext, expr: &Expr) {
if let ExprKind::MethodCall(method_call, args, _) = expr.kind {
if args.len() == 1 && method_call.ident.name == sym!(dupe) {
if let ExprKind::MethodCall(method_call, receiver, args, _) = expr.kind {
if args.is_empty() && method_call.ident.name == sym!(dupe) {
if let Some(dupe_trait) = clippy::get_trait_def_id(cx, &["gazebo", "dupe", "Dupe"]) {
if let Some(copy_marker) = clippy::get_trait_def_id(cx, &["std", "marker", "Copy"])
{
let mut duped_type = cx.typeck_results().expr_ty(&args[0]).peel_refs();
let mut duped_type = cx.typeck_results().expr_ty(receiver).peel_refs();
loop {
// Note that we could be calling `dupe` on a `&Foo`. All `&` types are
// `Copy`, so we actually need to make sure the current type we are looking
Expand Down Expand Up @@ -511,7 +511,7 @@ fn check_use_bail_and_ensure(cx: &LateContext, expr: &Expr) {
if clippy::path_to_res(cx, &["anyhow", "private", "Err"])
== clippy::path_to_res(cx, &["core", "result", "Result", "Err"])
{
if let Some(res) = path.segments[1].res.and_then(unpack_non_local) {
if let Some(res) = unpack_non_local(path.segments[1].res) {
if clippy::path_to_res(cx, &["anyhow", "private"])
.map_or(false, |x| x == res)
&& path.segments[2].ident.as_str() == "Err"
Expand Down Expand Up @@ -673,7 +673,7 @@ fn register_plugin(reg: &mut Registry) {
];

reg.lint_store.register_lints(&lints);
reg.lint_store.register_late_pass(|| box Pass);
reg.lint_store.register_late_pass(|_| box Pass);
reg.lint_store.register_group(
true,
"gazebo",
Expand Down

0 comments on commit 2a7b83e

Please sign in to comment.