Programming-Idioms

Implementation
Rust

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another Rust implementation.

Other implementations
for i, y := range items {
	if y == x {
		items = append(items[:i], items[i+1:]...)
		break
	}
}
for i, y := range items {
	if y == x {
		copy(items[i:], items[i+1:])
		items[len(items)-1] = nil
		items = items[:len(items)-1]
		break
	}
}
i = items.index(x)
items.delete_at(i) unless i.nil?
uses classes;
i := items.IndexOf(x);
if i <> -1 then
  items.delete(i);
import Data.List
delete x items
items.remove(x)
items.remove(x);
import std.algorithm;
items = items.remove(items.countUntil!(a => a == x));
use List::UtilsBy qw(extract_first_by);
extract_first_by { $x eq $_ } @items;
integer, dimension(:), allocatable :: items

i = findloc(items, x)
if (i /= 0) items = [items(1:i-1), items(i+1:)]
Java.utils.List
items.stream().findFirst().filter(item -> "x".equals(item)).ifPresent(removeIndex -> items.remove(removeIndex));
$list_position = array_search($x, $items);
$specific_item = $items[$position];
unset($specific_item);
using System.Collections.Generic;
items.Remove(x);
erase(items, x);
List.delete(items, x)