Your case is called “unsafe lane change” which is an offence. You might be still at fault (or partially) even though you are rear-ended.