mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Remove Prefable::terminator 🤖
This commit is contained in:
parent
adcecda047
commit
a20db08f06
3 changed files with 17 additions and 17 deletions
|
@ -557,24 +557,17 @@ pub struct Prefable<T: 'static> {
|
|||
pub pref: Option<&'static str>,
|
||||
/// The underlying slice of specifications.
|
||||
pub specs: &'static [T],
|
||||
/// Whether the specifications contain special terminating entries that should be
|
||||
/// included or not.
|
||||
pub terminator: bool,
|
||||
}
|
||||
|
||||
impl<T> Prefable<T> {
|
||||
/// Retrieve the slice represented by this container, unless the condition
|
||||
/// guarding it is false.
|
||||
pub fn specs(&self) -> &'static [T] {
|
||||
pub fn specs(&self) -> Option<&'static [T]> {
|
||||
if let Some(pref) = self.pref {
|
||||
if !prefs::get_pref(pref).as_boolean().unwrap_or(false) {
|
||||
return if self.terminator {
|
||||
&self.specs[self.specs.len() - 1..]
|
||||
} else {
|
||||
&[]
|
||||
};
|
||||
return None;
|
||||
}
|
||||
}
|
||||
self.specs
|
||||
Some(self.specs)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue