Rollup merge of #87720 - matthiaskrgr:clippy_into, r=jyn514
don't use .into() to convert types to identical types (clippy::useless_conversion) Example: let _x: String = String::from("hello world").into();
This commit is contained in:
commit
917c047c33
@ -599,7 +599,7 @@ pub(super) fn eval_operands(
|
||||
let ptr = self.global_base_pointer(Pointer::new(id, offset))?;
|
||||
Operand::Indirect(MemPlace::from_ptr(ptr.into(), layout.align.abi))
|
||||
}
|
||||
ConstValue::Scalar(x) => Operand::Immediate(tag_scalar(x.into())?.into()),
|
||||
ConstValue::Scalar(x) => Operand::Immediate(tag_scalar(x)?.into()),
|
||||
ConstValue::Slice { data, start, end } => {
|
||||
// We rely on mutability being set correctly in `data` to prevent writes
|
||||
// where none should happen.
|
||||
|
@ -73,7 +73,7 @@ pub(super) fn eval_terminator(
|
||||
ty::FnPtr(sig) => {
|
||||
let caller_abi = sig.abi();
|
||||
let fn_ptr = self.read_pointer(&func)?;
|
||||
let fn_val = self.memory.get_fn(fn_ptr.into())?;
|
||||
let fn_val = self.memory.get_fn(fn_ptr)?;
|
||||
(
|
||||
fn_val,
|
||||
caller_abi,
|
||||
|
@ -211,7 +211,7 @@ fn find_branch_value_info<'tcx>(
|
||||
return None;
|
||||
};
|
||||
let branch_value_scalar = branch_value.literal.try_to_scalar()?;
|
||||
Some((branch_value_scalar.into(), branch_value_ty, *to_switch_on))
|
||||
Some((branch_value_scalar, branch_value_ty, *to_switch_on))
|
||||
}
|
||||
_ => None,
|
||||
}
|
||||
|
@ -675,11 +675,10 @@ fn clean(&self, cx: &mut DocContext<'_>) -> Generics {
|
||||
if let Some(((_, trait_did, name), rhs)) =
|
||||
proj.as_ref().and_then(|(lhs, rhs)| Some((lhs.projection()?, rhs)))
|
||||
{
|
||||
impl_trait_proj.entry(param_idx).or_default().push((
|
||||
trait_did.into(),
|
||||
name,
|
||||
rhs,
|
||||
));
|
||||
impl_trait_proj
|
||||
.entry(param_idx)
|
||||
.or_default()
|
||||
.push((trait_did, name, rhs));
|
||||
}
|
||||
|
||||
return None;
|
||||
|
@ -1614,7 +1614,7 @@ impl Type {
|
||||
impl Type {
|
||||
fn inner_def_id(&self, cache: Option<&Cache>) -> Option<DefId> {
|
||||
let t: PrimitiveType = match *self {
|
||||
ResolvedPath { did, .. } => return Some(did.into()),
|
||||
ResolvedPath { did, .. } => return Some(did),
|
||||
DynTrait(ref bounds, _) => return bounds[0].trait_.inner_def_id(cache),
|
||||
Primitive(p) => return cache.and_then(|c| c.primitive_locations.get(&p).cloned()),
|
||||
BorrowedRef { type_: box Generic(..), .. } => PrimitiveType::Reference,
|
||||
|
@ -228,7 +228,7 @@ fn fold_item(&mut self, item: clean::Item) -> Option<clean::Item> {
|
||||
if i.blanket_impl.is_none() {
|
||||
self.cache
|
||||
.implementors
|
||||
.entry(did.into())
|
||||
.entry(did)
|
||||
.or_default()
|
||||
.push(Impl { impl_item: item.clone() });
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ fn tybounds<'a, 'tcx: 'a>(
|
||||
text: &'a str,
|
||||
cx: &'cx Context<'_>,
|
||||
) -> impl fmt::Display + 'a {
|
||||
let parts = href(did.into(), cx);
|
||||
let parts = href(did, cx);
|
||||
display_fn(move |f| {
|
||||
if let Ok((url, short_ty, fqp)) = parts {
|
||||
write!(
|
||||
@ -921,7 +921,7 @@ fn fmt_type<'cx>(
|
||||
// everything comes in as a fully resolved QPath (hard to
|
||||
// look at).
|
||||
box clean::ResolvedPath { did, .. } => {
|
||||
match href(did.into(), cx) {
|
||||
match href(did, cx) {
|
||||
Ok((ref url, _, ref path)) if !f.alternate() => {
|
||||
write!(
|
||||
f,
|
||||
|
@ -42,7 +42,7 @@
|
||||
name: item.name.unwrap().to_string(),
|
||||
path: fqp[..fqp.len() - 1].join("::"),
|
||||
desc,
|
||||
parent: Some(did.into()),
|
||||
parent: Some(did),
|
||||
parent_idx: None,
|
||||
search_type: get_index_search_type(&item, tcx),
|
||||
aliases: item.attrs.get_doc_aliases(),
|
||||
|
@ -293,7 +293,7 @@ fn variant_field(
|
||||
) -> Result<(Res, Option<String>), ErrorKind<'path>> {
|
||||
let tcx = self.cx.tcx;
|
||||
let no_res = || ResolutionFailure::NotResolved {
|
||||
module_id: module_id.into(),
|
||||
module_id: module_id,
|
||||
partial_res: None,
|
||||
unresolved: path_str.into(),
|
||||
};
|
||||
@ -521,7 +521,7 @@ fn resolve<'path>(
|
||||
// but the disambiguator logic expects the associated item.
|
||||
// Store the kind in a side channel so that only the disambiguator logic looks at it.
|
||||
if let Some((kind, id)) = side_channel {
|
||||
self.kind_side_channel.set(Some((kind, id.into())));
|
||||
self.kind_side_channel.set(Some((kind, id)));
|
||||
}
|
||||
Ok((res, Some(fragment)))
|
||||
};
|
||||
@ -1268,7 +1268,7 @@ fn resolve_link(
|
||||
// doesn't allow statements like `use str::trim;`, making this a (hopefully)
|
||||
// valid omission. See https://github.com/rust-lang/rust/pull/80660#discussion_r551585677
|
||||
// for discussion on the matter.
|
||||
verify(kind, id.into())?;
|
||||
verify(kind, id)?;
|
||||
|
||||
// FIXME: it would be nice to check that the feature gate was enabled in the original crate, not just ignore it altogether.
|
||||
// However I'm not sure how to check that across crates.
|
||||
@ -1306,9 +1306,9 @@ fn resolve_link(
|
||||
Some(ItemLink { link: ori_link.link, link_text, did: None, fragment })
|
||||
}
|
||||
Res::Def(kind, id) => {
|
||||
verify(kind, id.into())?;
|
||||
verify(kind, id)?;
|
||||
let id = clean::register_res(self.cx, rustc_hir::def::Res::Def(kind, id));
|
||||
Some(ItemLink { link: ori_link.link, link_text, did: Some(id.into()), fragment })
|
||||
Some(ItemLink { link: ori_link.link, link_text, did: Some(id), fragment })
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1886,7 +1886,7 @@ fn split(path: &str) -> Option<(&str, &str)> {
|
||||
name = start;
|
||||
for ns in [TypeNS, ValueNS, MacroNS] {
|
||||
if let Some(res) =
|
||||
collector.check_full_res(ns, &start, module_id.into(), &None)
|
||||
collector.check_full_res(ns, &start, module_id, &None)
|
||||
{
|
||||
debug!("found partial_res={:?}", res);
|
||||
*partial_res = Some(res);
|
||||
|
@ -45,7 +45,7 @@
|
||||
|
||||
// FIXME(eddyb) is this `doc(hidden)` check needed?
|
||||
if !cx.tcx.get_attrs(def_id).lists(sym::doc).has_word(sym::hidden) {
|
||||
let impls = get_auto_trait_and_blanket_impls(cx, def_id.into());
|
||||
let impls = get_auto_trait_and_blanket_impls(cx, def_id);
|
||||
new_items.extend(impls.filter(|i| cx.inlined.insert(i.def_id)));
|
||||
}
|
||||
});
|
||||
|
@ -192,7 +192,7 @@ fn maybe_inline_local(
|
||||
} else {
|
||||
// All items need to be handled here in case someone wishes to link
|
||||
// to them with intra-doc links
|
||||
self.cx.cache.access_levels.map.insert(did.into(), AccessLevel::Public);
|
||||
self.cx.cache.access_levels.map.insert(did, AccessLevel::Public);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ fn maybe_inline_local(
|
||||
None => return false,
|
||||
};
|
||||
|
||||
let is_private = !self.cx.cache.access_levels.is_public(res_did.into());
|
||||
let is_private = !self.cx.cache.access_levels.is_public(res_did);
|
||||
let is_hidden = inherits_doc_hidden(self.cx.tcx, res_hir_id);
|
||||
|
||||
// Only inline if requested or if the item would otherwise be stripped.
|
||||
|
Loading…
Reference in New Issue
Block a user