Claressa Shields widely outpointed Scotland's Hannah Rankin but was made to work hard by her brave opponent.