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

Commit 2a7b83e

Browse files
diliopfacebook-github-bot
authored andcommitted
update to Rust 1.65.0
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
1 parent efb7d9e commit 2a7b83e

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

gazebo_lint/src/clippy.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ pub fn method_calls<'tcx>(
5959

6060
let mut current = expr;
6161
for _ in 0..max_depth {
62-
if let ExprKind::MethodCall(path, args, _) = &current.kind {
62+
if let ExprKind::MethodCall(path, receiver, args, _) = &current.kind {
6363
method_names.push(path.ident.name);
6464
arg_lists.push(&**args);
6565
spans.push(path.ident.span);
66-
current = &args[0];
66+
current = receiver;
6767
if current.span.from_expansion() {
6868
break;
6969
}

gazebo_lint/src/lib.rs

+11-11
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ fn check_use_slice_cloned_kind(
318318
/// Look for `x.clone()`
319319
/// Where the type of `x` implements `Dupe`.
320320
fn check_use_dupe(cx: &LateContext, expr: &Expr) {
321-
if let ExprKind::MethodCall(method_call, args, _) = expr.kind {
322-
if args.len() == 1 && method_call.ident.name == sym!(clone) {
321+
if let ExprKind::MethodCall(method_call, receiver, args, _) = expr.kind {
322+
if args.is_empty() && method_call.ident.name == sym!(clone) {
323323
if let Some(dupe_trait) = clippy::get_trait_def_id(cx, &["gazebo", "dupe", "Dupe"]) {
324-
let mut cloned_type = cx.typeck_results().expr_ty(&args[0]).peel_refs();
324+
let mut cloned_type = cx.typeck_results().expr_ty(receiver).peel_refs();
325325
loop {
326326
if clippy::implements_trait(cx, cloned_type, dupe_trait, &[]) {
327327
emit_suggestion(
@@ -350,12 +350,12 @@ fn check_use_dupe(cx: &LateContext, expr: &Expr) {
350350
/// Look for `x.cloned()`
351351
/// Where the type of the `::Item` of `x` implements `Dupe`.
352352
fn check_use_duped(cx: &LateContext, expr: &Expr) {
353-
if let ExprKind::MethodCall(method_call, args, _) = expr.kind {
354-
if args.len() == 1 && method_call.ident.name == sym!(cloned) {
353+
if let ExprKind::MethodCall(method_call, receiver, args, _) = expr.kind {
354+
if args.is_empty() && method_call.ident.name == sym!(cloned) {
355355
if let Some(iterator_trait) =
356356
clippy::get_trait_def_id(cx, &["gazebo", "ext", "iter", "IterDuped"])
357357
{
358-
let mut cloned_type = cx.typeck_results().expr_ty(&args[0]);
358+
let mut cloned_type = cx.typeck_results().expr_ty(receiver);
359359
loop {
360360
if clippy::implements_trait(cx, cloned_type, iterator_trait, &[]) {
361361
emit_suggestion(
@@ -384,12 +384,12 @@ fn check_use_duped(cx: &LateContext, expr: &Expr) {
384384
/// Look for `x.dupe()`
385385
/// Where the type of `x` implements `Copy`.
386386
fn check_dupe_on_copy(cx: &LateContext, expr: &Expr) {
387-
if let ExprKind::MethodCall(method_call, args, _) = expr.kind {
388-
if args.len() == 1 && method_call.ident.name == sym!(dupe) {
387+
if let ExprKind::MethodCall(method_call, receiver, args, _) = expr.kind {
388+
if args.is_empty() && method_call.ident.name == sym!(dupe) {
389389
if let Some(dupe_trait) = clippy::get_trait_def_id(cx, &["gazebo", "dupe", "Dupe"]) {
390390
if let Some(copy_marker) = clippy::get_trait_def_id(cx, &["std", "marker", "Copy"])
391391
{
392-
let mut duped_type = cx.typeck_results().expr_ty(&args[0]).peel_refs();
392+
let mut duped_type = cx.typeck_results().expr_ty(receiver).peel_refs();
393393
loop {
394394
// Note that we could be calling `dupe` on a `&Foo`. All `&` types are
395395
// `Copy`, so we actually need to make sure the current type we are looking
@@ -511,7 +511,7 @@ fn check_use_bail_and_ensure(cx: &LateContext, expr: &Expr) {
511511
if clippy::path_to_res(cx, &["anyhow", "private", "Err"])
512512
== clippy::path_to_res(cx, &["core", "result", "Result", "Err"])
513513
{
514-
if let Some(res) = path.segments[1].res.and_then(unpack_non_local) {
514+
if let Some(res) = unpack_non_local(path.segments[1].res) {
515515
if clippy::path_to_res(cx, &["anyhow", "private"])
516516
.map_or(false, |x| x == res)
517517
&& path.segments[2].ident.as_str() == "Err"
@@ -673,7 +673,7 @@ fn register_plugin(reg: &mut Registry) {
673673
];
674674

675675
reg.lint_store.register_lints(&lints);
676-
reg.lint_store.register_late_pass(|| box Pass);
676+
reg.lint_store.register_late_pass(|_| box Pass);
677677
reg.lint_store.register_group(
678678
true,
679679
"gazebo",

0 commit comments

Comments
 (0)