]> git.lizzy.rs Git - rust.git/commitdiff
Remove two cases of unecesary match branches
authorSimonas Kazlauskas <git@kazlauskas.me>
Fri, 6 Mar 2015 21:05:11 +0000 (23:05 +0200)
committerSimonas Kazlauskas <git@kazlauskas.me>
Fri, 3 Apr 2015 12:48:07 +0000 (15:48 +0300)
src/librustc_trans/trans/attributes.rs

index a8e9ef98d71d98f0bedc00b3c31687f81723563b..2615490a9fbc5a584b4b0b7f0fe525df9a0323fb 100644 (file)
@@ -189,8 +189,7 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
             match ret_ty.sty {
                 // `~` pointer return values never alias because ownership
                 // is transferred
-                ty::ty_uniq(it) if !common::type_is_sized(ccx.tcx(), it) => {}
-                ty::ty_uniq(_) => {
+                ty::ty_uniq(it) if common::type_is_sized(ccx.tcx(), it) => {
                     attrs.ret(llvm::NoAliasAttribute);
                 }
                 _ => {}
@@ -199,9 +198,8 @@ pub fn from_fn_type<'a, 'tcx>(ccx: &CrateContext<'a, 'tcx>, fn_type: ty::Ty<'tcx
             // We can also mark the return value as `dereferenceable` in certain cases
             match ret_ty.sty {
                 // These are not really pointers but pairs, (pointer, len)
-                ty::ty_uniq(it) |
-                ty::ty_rptr(_, ty::mt { ty: it, .. }) if !common::type_is_sized(ccx.tcx(), it) => {}
-                ty::ty_uniq(inner) | ty::ty_rptr(_, ty::mt { ty: inner, .. }) => {
+                ty::ty_rptr(_, ty::mt { ty: inner, .. })
+                | ty::ty_uniq(inner) if common::type_is_sized(ccx.tcx(), inner) => {
                     let llret_sz = machine::llsize_of_real(ccx, type_of::type_of(ccx, inner));
                     attrs.ret(llvm::DereferenceableAttribute(llret_sz));
                 }