People with type 2 diabetes, heart disease, or stroke who slept well had better cognitive function and greater brain volume than those who slept poorly.