I've taken over a deploy process and part of this runs Cargo Clippy which was working fine up until late last week, when I started getting this error:
error: Question mark operator is useless here
I've read the suggested link https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark and understand that the ? is no longer required, and have had a look at the suggested changes it offers. I just want to know whether it is okay for me to make the changes as suggested, as some seem to remove some code so I'm not sure whether the result will be the same.
Some of the suggested changes seem to be simple and okay: From this
Ok(dsl::orgs
.filter(dsl::salesforce_id.eq(salesforce_id))
.get_result(conn)?)
To this:
dsl::orgs
.filter(dsl::salesforce_id.eq(salesforce_id))
.get_result(conn)
So I'm guessing that the above type of change is safe to accept?
Then I have these
Here the 'optional' has disappeared in the suggested fix. From:
Ok(dsl::orgs .filter( dsl::customer_id .eq(new_org.customer_id) .and(dsl::name.eq(&new_org.name)), ) .get_result(conn) .optional()?)
To
dsl::orgs .filter( dsl::customer_id .eq(new_org.customer_id) .and(dsl::name.eq(&new_org.name)), )
And this one, where the inner join has disappeared in the suggested fix:
Ok(orgs::dsl::orgs .filter(orgs::dsl::customer_id.eq(customer_id)) .filter(orgs::dsl::kind.eq(org_kind)) .filter( orgs::dsl::kind .eq(OrgKind::Production) .or(orgs::dsl::name.eq(&org_name)), ) .inner_join(schema::customers::dsl::customers) .get_result(conn)?)
to this:
orgs::dsl::orgs .filter(orgs::dsl::customer_id.eq(customer_id)) .filter(orgs::dsl::kind.eq(org_kind)) .filter( orgs::dsl::kind .eq(OrgKind::Production)
Are these 2 suggested fixes okay to implement? Could someone please provide some help?